1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-27 20:32:21 +00:00

Merge branch 'gh-pages' of github.com:ruanyf/es6tutorial into gh-pages

This commit is contained in:
ruanyf 2015-09-22 08:04:59 +08:00
commit aae41fcb21

View File

@ -205,10 +205,10 @@ function f(){
}
}
f() // 没有输出
f() // undefined
```
上面代码中函数f执行后没有任何输出原因在于变量提升导致内层的tmp变量覆盖了外层的tmp变量。
上面代码中函数f执行后,输出结果为`undefined`原因在于变量提升导致内层的tmp变量覆盖了外层的tmp变量。
第二种场景,用来计数的循环变量泄露为全局变量。