There are 6 values of "false" in JavaScript, and these six values are:
- False
- Null
- Undefined
- 0
- "(empty string)
- NaN
In this case, false itself is a Boolean type, and the other 5 are not.
In addition to these 6, the others are "true", including objects, arrays, regular, functions, and so on. Note that ' 0 ', ' null ', ' false ', {}, [] are also true.
Although these six values are "false", they are not all equal:
1Console.log (false==NULL)//false2Console.log (false= = undefined)//false3Console.log (false= = 0)//true4Console.log (false= = ")//true5Console.log (false= = NaN)//false6 7Console.log (NULL= = undefined)//true8Console.log (NULL= = 0)//false9Console.log (NULL= = ")//falseTenConsole.log (NULL= = NaN)//false One AConsole.log (undefined = = 0)//false -Console.log (undefined = = ")//false -Console.log (undefined = = NaN)//false the -Console.log (0 = = ")//true -Console.log (0 = = NaN)//false
for "= =", the following conclusions are drawn:
- False except that compared to itself is true, and 0, "" is also true
- Null is only true when compared to undefined, in turn undefined only and null are compared to true, without a second
- 0 except and false compare to true, there is an empty string "'" and an empty array []
- The empty string ' In addition to false compares to true, there is also a number 0
Reference connection: http://www.cnblogs.com/snandy/p/3589517.html
The false value of a wonderful flower in JavaScript