From 76aea3a65a1ef9f1060698fa54c3607d8217a453 Mon Sep 17 00:00:00 2001 From: Songhn Date: Tue, 6 Apr 2021 17:38:22 +0800 Subject: [PATCH 1/2] UPD(async-await): update to 2021-03-19 --- 1-js/11-async/08-async-await/article.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/1-js/11-async/08-async-await/article.md b/1-js/11-async/08-async-await/article.md index c193ce55c6..32f964a0fe 100644 --- a/1-js/11-async/08-async-await/article.md +++ b/1-js/11-async/08-async-await/article.md @@ -139,6 +139,8 @@ let user = await response.json(); ... })(); ``` + +P.S. 新特性:从 v8 引擎 8.9 版本开始,顶层 await 可以在 [模块](info:modules) 中工作。 ```` ````smart header="`await` 接受 \"thenables\"" @@ -184,7 +186,7 @@ class Waiter { new Waiter() .wait() - .then(alert); // 1 + .then(alert); // 1 ( alert 等同于 result => alert(result) ) ``` 这里的含义是一样的:它确保了方法的返回值是一个 promise 并且可以在方法中使用 `await`。 From cda50b5f95d40a19e32f9d349c817ea3d67bd29c Mon Sep 17 00:00:00 2001 From: LeviDing Date: Mon, 19 Apr 2021 22:59:38 +0800 Subject: [PATCH 2/2] Update article.md --- 1-js/11-async/08-async-await/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/11-async/08-async-await/article.md b/1-js/11-async/08-async-await/article.md index 32f964a0fe..e365f8442f 100644 --- a/1-js/11-async/08-async-await/article.md +++ b/1-js/11-async/08-async-await/article.md @@ -140,7 +140,7 @@ let user = await response.json(); })(); ``` -P.S. 新特性:从 v8 引擎 8.9 版本开始,顶层 await 可以在 [模块](info:modules) 中工作。 +P.S. 新特性:从 V8 引擎 8.9+ 版本开始,顶层 await 可以在 [模块](info:modules) 中工作。 ```` ````smart header="`await` 接受 \"thenables\"" @@ -186,7 +186,7 @@ class Waiter { new Waiter() .wait() - .then(alert); // 1 ( alert 等同于 result => alert(result) ) + .then(alert); // 1(alert 等同于 result => alert(result)) ``` 这里的含义是一样的:它确保了方法的返回值是一个 promise 并且可以在方法中使用 `await`。