File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ I summarized all the loop/iterators related APIs here:
34
34
35
35
### ES5
36
36
37
- - [ ` for...break ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for )
37
+ - [ ` classic for loop ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for )
38
38
- [ ` for...in ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in )
39
39
- [ ` Array.prototype.forEach() ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach )
40
40
为 Array 对象引入了 Array.forEach 方法以代替 for 循环,Array.forEach 方法的特点是自带闭包,以解决因为缺乏块级作用域导致需要使用取巧的方法来解决 var 的作用域问题。
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ if (false) {
290
290
291
291
/*
292
292
Async calls in sequence
293
- Best Choice: for...of
293
+ Best Choice: for...of or classic for loop
294
294
295
295
Async calls in parallel
296
296
Best Choice: .map()
@@ -311,6 +311,7 @@ if (false) {
311
311
}
312
312
313
313
async function asyncForIn ( testArr ) {
314
+ // eslint-disable-next-line no-restricted-syntax
314
315
for ( let x of testArr ) {
315
316
console . log ( `forIn's ${ x } starts at ${ currentDateString ( ) } ` ) ;
316
317
await asyncPrint ( x ) ;
You can’t perform that action at this time.
0 commit comments