Skip to content

Commit 30ece36

Browse files
authoredMar 29, 2024
no-array-for-each: Document another benefit of for-of (#2303)
1 parent 231529a commit 30ece36

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎docs/rules/no-array-for-each.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Benefits of [`for…of` statement](https://developer.mozilla.org/en-US/docs/Web/
1212
- Faster
1313
- Better readability
1414
- Ability to exit early with `break` or `return`
15+
- Ability to skip iterations with `continue`
1516

1617
Additionally, using `for…of` has great benefits if you are using TypeScript, because it does not cause a function boundary to be crossed. This means that type-narrowing earlier on in the current scope will work properly while inside of the loop (without having to re-type-narrow). Furthermore, any mutated variables inside of the loop will picked up on for the purposes of determining if a variable is being used.
1718

0 commit comments

Comments
 (0)