-
undefined和null在if语句中,都会被自动转为false,相等运算符甚至直接报告两者相等
undefined == null
// true -
Number(null) => 0
5+null => 5Number(undefined) => NaN
5+undefined => NaN
详细请查看阮一峰的文档http://www.ruanyifeng.com/blog/2014/03/undefined-vs-null.html?utm_source=tuicool&utm_medium=referral