Skip to content

Commit e9ff296

Browse files
committed
修订错误
1 parent cb9bccc commit e9ff296

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

docs/generator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ loadUI.next()
105105

106106
```
107107

108-
上面代码表示,第一次调用loadUI函数时,该函数不会执行,仅返回一个遍历器。下一次对该遍历器调用next方法,则会显示登录窗口,并且异步加载数据。再一次使用next方法,则会隐藏登录窗口。可以看到,这种写法的好处是所有登录窗口的逻辑,都被封装在一个函数,按部就班非常清晰。
108+
上面代码表示,第一次调用loadUI函数时,该函数不会执行,仅返回一个遍历器。下一次对该遍历器调用next方法,则会显示登录界面,并且异步加载数据。再一次使用next方法,则会隐藏登录界面。可以看到,这种写法的好处是所有登录界面的逻辑,都被封装在一个函数,按部就班非常清晰。
109109

110110
注意,yield语句是同步运行,不是异步运行(否则就失去了取代回调函数的设计目的了)。实际操作中,一般让yield语句返回Promises对象。
111111

docs/intro.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,25 @@ node --harmony
5050

5151
```
5252

53-
启动命令中的`--harmony`选项可以打开大部分的ES6功能,但是还有一些特性,需要单独打开,主要是使用`--use_strict`选项打开块级作用域功能、使用`--harmony_generators`选项打开generator功能。
54-
55-
使用下面的命令,可以查看所有与ES6有关的选项。
53+
启动命令中的`--harmony`选项可以打开所有已经部署的ES6功能。使用下面的命令,可以查看所有与ES6有关的单个选项。
5654

5755
```bash
5856

59-
node --v8-options | grep harmony
57+
$ node --v8-options | grep harmony
58+
--harmony_typeof (enable harmony semantics for typeof)
59+
--harmony_scoping (enable harmony block scoping)
60+
--harmony_modules (enable harmony modules (implies block scoping))
61+
--harmony_symbols (enable harmony symbols (a.k.a. private names))
62+
--harmony_proxies (enable harmony proxies)
63+
--harmony_collections (enable harmony collections (sets, maps, and weak maps))
64+
--harmony_observation (enable harmony object observation (implies harmony collections)
65+
--harmony_generators (enable harmony generators)
66+
--harmony_iteration (enable harmony iteration (for-of))
67+
--harmony_numeric_literals (enable harmony numeric literals (0o77, 0b11))
68+
--harmony_strings (enable harmony string)
69+
--harmony_arrays (enable harmony arrays)
70+
--harmony_maths (enable harmony math functions)
71+
--harmony (enable all harmony features (except typeof))
6072

6173
```
6274

docs/let.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function f1() {
8484

8585
上面的函数有两个代码块,都声明了变量n,运行后输出5。这表示外层代码块不受内层代码块的影响。如果使用var定义变量n,最后输出的值就是10。
8686

87-
块级作用域的出现,实际上使得获得广泛应用的立即执行函数(IIFE)不再必要了。
87+
块级作用域的出现,实际上使得获得广泛应用的立即执行匿名函数(IIFE)不再必要了。
8888

8989
```javascript
9090

@@ -102,14 +102,14 @@ function f1() {
102102

103103
```
104104

105-
另外,ES6的函数也默认在块级作用域内声明
105+
另外,ES6也规定,函数的作用域为其所在的块级作用域
106106

107107
```javascript
108108

109109
function f() { console.log('I am outside!'); }
110110
(function () {
111111
if(false) {
112-
// What should happen with this redeclaration?
112+
// 重复声明一次函数f
113113
function f() { console.log('I am inside!'); }
114114
}
115115

0 commit comments

Comments
 (0)