File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ This of course does **not** include any code
30
30
that uses ad-hoc ` for await ` –` of ` loops with empty arrays:
31
31
``` js
32
32
const arr = [];
33
- for await (const item of asyncItems ) {
34
- arr .push (await item );
33
+ for await (const v of asyncIterable ) {
34
+ arr .push (v );
35
35
}
36
36
```
37
37
Further demonstrating the demand for such functionality,
@@ -71,7 +71,7 @@ async function * asyncGen (n) {
71
71
// `arr` will be `[0, 2, 4, 6]`.
72
72
const arr = [];
73
73
for await (const v of asyncGen (4 )) {
74
- arr .push (await v);
74
+ arr .push (v);
75
75
}
76
76
77
77
// This is equivalent.
@@ -96,7 +96,7 @@ function * genPromises (n) {
96
96
// `arr` will be `[ 0, 2, 4, 6 ]`.
97
97
const arr = [];
98
98
for await (const v of genPromises (4 )) {
99
- arr .push (await v);
99
+ arr .push (v);
100
100
}
101
101
102
102
// This is equivalent.
@@ -175,7 +175,7 @@ const arrLike = {
175
175
// `arr` will be `[ 0, 2, 4, 6 ]`.
176
176
const arr = [];
177
177
for await (const v of Array .from (arrLike)) {
178
- arr .push (await v);
178
+ arr .push (v);
179
179
}
180
180
181
181
// This is equivalent.
You can’t perform that action at this time.
0 commit comments