xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

你不知道的 JavaScript 细节: not defined !== undefined

你不知道的 JavaScript 细节: not defined !== undefined

not defined !== undefined

Demo:(Chrome 版本 51.0.2704.106 m (64-bit))


var x;

console.log(typeof x);
// undefined : x 没有初始化
y = 1;
console.log(typeof y);
// number : y 没有声明,有初始化
var x1="x1";
console.log(typeof x1);
// string : x1 有声明,有初始化
y1;
console.log(typeof y1);
// Uncaught ReferenceError: y1 is not defined : y1 没有声明,没有初始化

demos

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

http://www.cnblogs.com/realwall/archive/2011/10/07/2200746.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2016-07-20 19:45  xgqfrms  阅读(10)  评论(0编辑  收藏  举报