Tagged articles
6 articles
Page 1 of 1
JavaScript
JavaScript
Oct 31, 2025 · Frontend Development

Why forEach Is Losing Favor: Switch to for...of for Safer Async Loops

The article explains why Array.prototype.forEach is increasingly discouraged in modern JavaScript, especially when combined with async/await, and shows how replacing it with a for...of loop resolves asynchronous pitfalls, enables proper flow‑control statements, and improves code clarity.

/loopJavaScriptarray methods
0 likes · 5 min read
Why forEach Is Losing Favor: Switch to for...of for Safer Async Loops
JavaScript
JavaScript
Sep 7, 2025 · Frontend Development

Why forEach Is Losing Favor: Switch to for...of for Async JavaScript Loops

The article explains why Array.prototype.forEach is increasingly discouraged in modern JavaScript, especially with async/await, and demonstrates how replacing it with a for...of loop resolves async handling, break/continue control, and improves code clarity.

JavaScriptasync/awaitfor...of
0 likes · 6 min read
Why forEach Is Losing Favor: Switch to for...of for Async JavaScript Loops
Java High-Performance Architecture
Java High-Performance Architecture
Aug 3, 2021 · Frontend Development

Which JavaScript Loop Wins? A Speed and Use‑Case Battle of for, forEach, map, for…in and for…of

This article compares five JavaScript iteration constructs—classic for, forEach, map, for...in and for...of—explaining their origins, semantics, performance characteristics, and appropriate use‑cases, while providing concrete code examples and guidance on breaking, continuing, and avoiding common pitfalls.

JavaScriptMAPfor loop
0 likes · 12 min read
Which JavaScript Loop Wins? A Speed and Use‑Case Battle of for, forEach, map, for…in and for…of
KooFE Frontend Team
KooFE Frontend Team
Feb 9, 2021 · Frontend Development

Which JavaScript Loop Is Fastest? Benchmark Results and Best Use Cases

This article compares the performance of common JavaScript looping constructs—including for, reverse for, forEach, for...of, for...in, and for...await—provides benchmark code on a million‑element array, explains the speed differences, and offers guidance on choosing the right loop for readability and maintainability.

JavaScriptLoopsbenchmark
0 likes · 7 min read
Which JavaScript Loop Is Fastest? Benchmark Results and Best Use Cases
Vipshop Quality Engineering
Vipshop Quality Engineering
Aug 8, 2017 · Frontend Development

Why for…in Breaks JavaScript Arrays and How for…of Fixes It

This article examines a production incident caused by using the ES5 for...in loop to iterate over arrays, explains its pitfalls such as prototype pollution and string indexes, and demonstrates why switching to the ES6 for...of construct provides safer, more predictable array traversal.

JavaScriptarray iterationes6
0 likes · 6 min read
Why for…in Breaks JavaScript Arrays and How for…of Fixes It