null和undefined的区别?

null表示数字、字符串和对象是无值的。

undefined表示变量声明但没有初始化时要查询的对象属性或数组的元素不存在时如果函数没有任何返回值,则返回undefined④引用没有提供实参的函数形参的值也只会得到undefined

 

typeof(null)    //'object'
null == undefined   //true
null === undefined   //false
null == false     //false
undefined == false     //false

 

  

 

posted @ 2020-06-09 11:36  neo_o  阅读(259)  评论(0编辑  收藏  举报

愿你的生活只有诗和远方