复制代码 代码如下: var strict = (function(){return !this;}());
如果在JavaScript程序中创建了全局变量,那么这个全局变量会成为全局对象中的一个属性。
实验
复制代码 代码如下: var a = this; console.log(a);//window object console.log(a.outerWidth);//access window object"s attribute console.log(a.isNaN);//access JS global object"s attribute x = "test"; console.log(a.x);//access newly created global variable value