Skip to content

Commit 3468b0d

Browse files
author
Wayne Mao
committed
test: ignore eslint since for...in is the best choice
1 parent 372d4ac commit 3468b0d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ I summarized all the loop/iterators related APIs here:
3434

3535
### ES5
3636

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)
3838
- [`for...in`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in)
3939
- [`Array.prototype.forEach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
4040
为 Array 对象引入了 Array.forEach 方法以代替 for 循环,Array.forEach 方法的特点是自带闭包,以解决因为缺乏块级作用域导致需要使用取巧的方法来解决 var 的作用域问题。

src/TestLoop.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ if (false) {
290290

291291
/*
292292
Async calls in sequence
293-
Best Choice: for...of
293+
Best Choice: for...of or classic for loop
294294
295295
Async calls in parallel
296296
Best Choice: .map()
@@ -311,6 +311,7 @@ if (false) {
311311
}
312312

313313
async function asyncForIn(testArr) {
314+
// eslint-disable-next-line no-restricted-syntax
314315
for (let x of testArr) {
315316
console.log(`forIn's ${x} starts at ${currentDateString()}`);
316317
await asyncPrint(x);

0 commit comments

Comments
 (0)