1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-29 05:42:20 +00:00

Merge pull request #1122 from condorheroblog/patch-1

docs(async):  fix typo
This commit is contained in:
Ruan YiFeng 2022-07-06 12:03:15 +08:00 committed by GitHub
commit 7d22df8e29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -733,7 +733,7 @@ const data = await fetch('https://api.example.com');
上面代码中,`await`命令独立使用,没有放在 async 函数里面,就会报错。
从 [ES2022](https://github.com/tc39/proposal-top-level-await) 开始,允许在模块的顶层独立使用`await`命令,使得上面那行代码不会报错了。它的要目的,是使用`await`解决模块异步加载的问题。
从 [ES2022](https://github.com/tc39/proposal-top-level-await) 开始,允许在模块的顶层独立使用`await`命令,使得上面那行代码不会报错了。它的要目的,是使用`await`解决模块异步加载的问题。
```javascript
// awaiting.js