js判断true和false

数据类型 转化为true的值 转化为false的值
Boolean true false
String 任何非空字符串 “”(空字符串)【注意:Boolean(“”) === false,Boolean(” “) === true】
Number 任何非零数字值(包括无穷大) 0 和 NaN
Object 任何对象 null
Undefined n/a (not applicable 不适用) undefined

猜你喜欢

转载自blog.csdn.net/qq_35087256/article/details/80445228