JavaScript Iterators
Introduction Iterators offer an alternative to the classic for loop in JavaScript/TypeScript. You have probably used them without even knowing it. const arr = [1, 2, 3]; // `for...of` loops use iterators for (const el of arr) { // do something } The for...of loop will feature prominently throughout this article but there are several other common use case for iterators such as spread syntax.