Boolean type conversion.
'' == '0' //false
0 == '' //true
0 == '0' //true
false == 'false' //false
false == '0' //true
false == undefined //false
false == null //false
null == undefined //true
"
" == 0 //true
As well as the difference between null
and undefined
. As listed in the table above, comparing null
& undefined
with ==
returns true, but with ===
it returns false. This behavior makes sense once you understand that undefined
is very different from a variable having a null
value, and something holding the value undefined
is different from something being undefined.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…