forked from theluyuan/Web
update: JS预编译
This commit is contained in:
parent
c2f9247e4a
commit
26452883f4
@ -37,16 +37,21 @@ function foo() {
|
||||
|
||||
foo();
|
||||
|
||||
console.log(window.a); // 在全局范围内访问 a
|
||||
console.log(window.b); // 在全局范围内访问 b
|
||||
console.log(window.a); // 在全局范围内访问 a
|
||||
console.log(a); // 在全局范围内访问 a,但是前面没有加 window 这个关键字
|
||||
|
||||
```
|
||||
|
||||
上方代码的打印结果:
|
||||
|
||||
```
|
||||
100
|
||||
|
||||
undefined
|
||||
|
||||
100
|
||||
(会报错,提示 Uncaught ReferenceError: a is not defined)
|
||||
|
||||
```
|
||||
|
||||
**解释**:
|
||||
|
Loading…
Reference in New Issue
Block a user