Skip to content

Commit 6e94400

Browse files
committed
docs(async): 拆分 generator 函数的异步操作与 async 函数
1 parent 4bf719e commit 6e94400

File tree

8 files changed

+951
-934
lines changed

8 files changed

+951
-934
lines changed

docs/async.md

Lines changed: 170 additions & 910 deletions
Large diffs are not rendered by default.

docs/function.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ sum(1, 100000)
15491549

15501550
## 函数参数的尾逗号
15511551

1552-
ECMAScript 2017将[允许](https://github.com/jeffmo/es-trailing-function-commas)函数的最后一个参数有尾逗号(trailing comma)。
1552+
ES2017 [允许](https://github.com/jeffmo/es-trailing-function-commas)函数的最后一个参数有尾逗号(trailing comma)。
15531553

15541554
此前,函数定义和调用时,都不允许最后一个参数后面出现逗号。
15551555

@@ -1567,7 +1567,7 @@ clownsEverywhere(
15671567

15681568
上面代码中,如果在`param2``bar`后面加一个逗号,就会报错。
15691569

1570-
这样的话,如果以后修改代码,想为函数`clownsEverywhere`添加第三个参数,就势必要在第二个参数后面添加一个逗号。这对版本管理系统来说,就会显示,添加逗号的那一行也发生了变动。这看上去有点冗余,因此新的语法允许定义和调用时,尾部直接有一个逗号。
1570+
这样的话,如果以后修改代码,想为函数`clownsEverywhere`添加第三个参数,就势必要在第二个参数后面添加一个逗号。这对版本管理系统来说,就会显示添加逗号的那一行也发生了变动。这看上去有点冗余,因此新的语法允许定义和调用时,尾部直接有一个逗号。这与数组和对象的尾逗号规则,保持一致了
15711571

15721572
```javascript
15731573
function clownsEverywhere(
@@ -1580,3 +1580,4 @@ clownsEverywhere(
15801580
'bar',
15811581
);
15821582
```
1583+

0 commit comments

Comments
 (0)