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

docs: edit async typo

This commit is contained in:
ruanyf 2017-01-08 00:15:31 +08:00
parent e1abf373a3
commit da273bb792

View File

@ -1433,9 +1433,9 @@ async function f() {
```javascript
let body = '';
for await(const data on req) body += data;
for await(const data of req) body += data;
const parsed = JSON.parse(body);
console.log("got", parsed);
console.log('got', parsed);
```
上面代码中,`req`是一个 asyncIterable 对象,用来异步读取数据。可以看到,使用`for await...of`循环以后,代码会非常简洁。