console.log(a)//报错 Uncaught ReferenceError: conaole is not defined(…)
var a;console.log(a)//不报错 输出undefined
区别:
undefined var a;只定义,没有赋值
null 不存在
"" var a="";浏览器中a赋值为“”
undefined null ""
原文:http://warmdoll.blog.51cto.com/10881334/1748154