类型检测使用typeof,对象检测使用instanceof,
null或者undefined的检测使用 ==null
布尔表达式返回true:
- 字符串0,'0'
- 空数组,[]
- 空对象,{}
布尔表达式返回false:
- null,为空
- undefined,未定义
- 空字符串,'',单引号双引号,中间有空格都为true
- 数字0,0
- NaN,一般为无法计算结果
类型检测使用typeof,对象检测使用instanceof,
null或者undefined的检测使用 ==null
布尔表达式返回true:
布尔表达式返回false: