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

update let.md

This commit is contained in:
LeeY 2015-09-13 18:24:31 +08:00
parent 1f9f4914bd
commit c684637099

View File

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