我正在尝试弄清楚为什么"use strict"不像我期望的那样起作用。看看这个有效的例子。
"use strict"
x='Justin';
console.log(x)
正如预期的那样,这会产生一个错误,指出x未定义。但接下来看一下这个例子
"use strict"
name='Justin';
console.log(name)
我正在尝试弄清楚为什么"use strict"不像我期望的那样起作用。看看这个有效的例子。
"use strict"
x='Justin';
console.log(x)
正如预期的那样,这会产生一个错误,指出x未定义。但接下来看一下这个例子
"use strict"
name='Justin';
console.log(name)
window.name
。 - chovyevent
是另一个全局变量,可能会让你感到困惑。 - Valentin