LiuL0703 / blog

https://liul0703.github.io
38 stars 11 forks source link

NULL和Undefined的区别 #4

Open LiuL0703 opened 6 years ago

LiuL0703 commented 6 years ago

null表示"没有对象",即该处不应该有值 简单的用法如:

undefined表示"缺少值",就是此处应该有一个值,但是还没有定义

其他

 null === undefined // false
 null == undefined // true
 null === null // true

 null = 'value' // ReferenceError
 undefined = 'value' // 'value'