以下6种情况判断结果为“假”: 1.false(布尔类型) 2.null(用于定义空的或者不存在的引用) 3.undefined(未定义) 4.0(数值0) 5.''(空字符串) 6.NaN
这里面 false 本身是布尔类型,其它 5 个则不是。
除了这 6 个外,其它均为“真” ,包括对象、数组、正则、函数等。注意 '0'、'null'、'false'、{}、[]也都是真值
摘自:https://blog.csdn.net/cplvfx/article/details/70680889