https://www.ruanyifeng.com/blog/2014/03/undefined-vs-null.html
if (!undefined)
console.log('undefined is false');
// undefined is false
if (!null)
console.log('null is false');
// null is false
undefined == null
// true
Number(undefined)
// NaN
5 + undefined
// NaN
null表示"没有对象",即该处不应该有值。undefined表示"缺少值",就是此处应该有一个值,但是还没有定义。
undefined, null, 数值转换, NaN, 缺少值
理解JavaScript中的undefined和null的区别,undefined表示缺少值,null表示没有对象,两者在布尔上下文中均为false,但在数值转换中表现不同。