Skip to content

Commit 0acfb86

Browse files
savokissleviding
andauthored
Update 1-js/11-async/08-async-await/article.md
Co-Authored-By: LeviDing <imdingxuewen@gmail.com>
1 parent 42b217a commit 0acfb86

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

1-js/11-async/08-async-await/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ f().catch(alert); // TypeError: failed to fetch // (*)
267267

268268

269269
```smart header="`async/await``promise.then/catch`"
270-
当我们使用 `async/await` 时,几乎就不会用到 `.then` 了,因为为我们`await` 处理了异步等待。并且我们可以用 `try...catch` 来替代 `.catch`。这通常更加方便(当然不是绝对的)。
270+
当我们使用 `async/await` 时,几乎就不会用到 `.then` 了,因为为我们 `await` 处理了异步等待。并且我们可以用 `try..catch` 来替代 `.catch`。这通常更加方便(当然不是绝对的)。
271271

272272
但是当我们在顶层代码,外面并没有任何 `async` 函数,我们在语法上就不能使用 `await` 了,所以这时候就可以用 `.then/catch` 来处理结果和异常。
273273

0 commit comments

Comments
 (0)