1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

Update desc for function scope in block scope.

This commit is contained in:
hotoo 2014-05-19 10:36:49 +08:00
parent 52386d10f6
commit b744b68e61

View File

@ -11,7 +11,7 @@ ES6新增了let命令用来声明变量。它的用法类似于var但是
var b = 1; var b = 1;
} }
a // ReferenceError: a is not defined. a // ReferenceError: a is not defined.
b //1 b //1
``` ```
@ -102,10 +102,10 @@ function f1() {
```javascript ```javascript
// IIFE写法 // IIFE写法
(function () { (function () {
var tmp = ...; var tmp = ...;
... ...
}()); }());
// 块级作用域写法 // 块级作用域写法
{ {
@ -115,7 +115,7 @@ function f1() {
``` ```
另外ES6也规定函数的作用域为其所在的块级作用域 另外ES6也规定函数本身的作用域,在其所在的块级作用域之内
```javascript ```javascript