如果计数 == 0 和其他计数 == 0
if count == 0 AND otherCount == 0
我有 2 个计数器“goFoods”和“count”。我想要一个 if 语句来检查 goFoods 是否已达到 9 AND 计数是否超过 6,然后使 TryAgain div 可见。我已经试过了,但是没有用。
function checkTryAgain() {
if(goFoods == 9; && count >= 6; ){
$("#TryAgain").css({visibility: 'visible',});
}}
如果您从 if 语句中删除分号,它会正常工作:
let goFoods = 9, count = 6
function checkTryAgain() {
if(goFoods == 9 && count >= 6){
$("#TryAgain").css({visibility: 'visible',});
}}
checkTryAgain()
#TryAgain{
visibility: hidden;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="TryAgain">Try Again</div>
我有 2 个计数器“goFoods”和“count”。我想要一个 if 语句来检查 goFoods 是否已达到 9 AND 计数是否超过 6,然后使 TryAgain div 可见。我已经试过了,但是没有用。
function checkTryAgain() {
if(goFoods == 9; && count >= 6; ){
$("#TryAgain").css({visibility: 'visible',});
}}
如果您从 if 语句中删除分号,它会正常工作:
let goFoods = 9, count = 6
function checkTryAgain() {
if(goFoods == 9 && count >= 6){
$("#TryAgain").css({visibility: 'visible',});
}}
checkTryAgain()
#TryAgain{
visibility: hidden;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="TryAgain">Try Again</div>