If the judgment of the conditions for undefinde, judge is flase, how to understand, as shown in figure of the count [x] initial values for undefind for determining
CodePudding user response:
If (count [x]) {//if the count [x] is undefined if (undefined) is equivalent to the if (undefined==true) if equal to perform if under the condition of output The console. The log (false)//conditions are not set up this sentence does not perform } else { The console. The log (true)//results can output the } CodePudding user response:
If condition results through Boolean function is converted to Boolean values, and Boolean (undefined) to false (' ', 0, undefined, null, NaN is false)
CodePudding user response:
reference 1st floor front _ rookie response: If (count [x]) {//if the count [x] is undefined if (undefined) is equivalent to the if (undefined==true) if equal to perform if under the condition of output The console. The log (false)//conditions are not set up this sentence does not perform } else { The console. The log (true)//results can output the } See, I began to thought in the if need to be converted to Boolean values to do judgment, thank CodePudding user response:
reference 1st floor front _ rookie response: If (count [x]) {//if the count [x] is undefined if (undefined) is equivalent to the if (undefined==true) if equal to perform if under the condition of output The console. The log (false)//conditions are not set up this sentence does not perform } else { The console. The log (true)//results can output the } But is undefind flase CodePudding user response:
reference 4 floor qq_45709715 response: Quote: reference 1st floor front _ rookie response: If (count [x]) {//if the count [x] is undefined if (undefined) is equivalent to the if (undefined==true) if equal to perform if under the condition of output The console. The log (false)//conditions are not set up this sentence does not perform } else { The console. The log (true)//results can output the } But is undefind flase Undefinded itself is false, you can console again, make a comparison the if () such a statement is to see if this is true sometimes is determine whether this thing has a value, have what value is executed operation, perform other operations without value, much to the console output, look at these, such as an empty string is false, the null is also false these conditions can give you to do the input box is not empty certification CodePudding user response:
refer to fifth floor front _ rookie response: Quote: refer to 4th floor qq_45709715 response: Quote: refer to 1st floor front _ rookie response: If (count [x]) {//if the count [x] is undefined if (undefined) is equivalent to the if (undefined==true) if equal to perform if under the condition of output The console. The log (false)//conditions are not set up this sentence does not perform } else { The console. The log (true)//results can output the } But is undefind flase Undefinded itself is false, you can console again, make a comparison the if () such a statement is to see if this is true sometimes is determine whether this thing has a value, have what value is executed operation, perform other operations without value, much to the console output, look at these, such as an empty string is false, the null is also false these conditions can give what you used to do the input box is not empty certification Yes, if can go directly to transform, it is wrong to me CodePudding user response:
If the true and false: Of the following would be considered returns false (vice is true) "" empty string The number of 0 Null object For objects of undefined Boolean value of false