Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有如下声明:
var j;
j==null直到我将它设置为等于某事?
j==null
不,它具有默认值undefined 但是如果想使用!j条件,它将与这两个值一起使用(即undefined或null)
undefined
!j
请注意(j==null)is true, but (j===null)is false... JavaScript 有“假”值,有时还有意想不到的规则来转换值,加上花哨===的运算符来同时比较值和类型。
(j==null)
true
(j===null)
false
===