JavaScript Iterators Guide
Iterators and generators provide a protocol for sequentially accessing data. The iteration protocol is used by `for...of`, spread operator, and destructuring. The guide walks through Iterator Protocol, Generator Functions, Async Iteration. An object is an iterator when it has a `next()` method returning `{value, done}`. `done: true` signals completion. Many built-in types (arrays, strings, maps, sets) are iterable via `Symbol.iterator`. `function* name() {}` defines a generator. `yield` pauses execution and returns a value. `yield*` delegates to another iterable. Generators maintain their execution state between calls. The guide is organized into 3 sections that build on each other, each pairing a prose explanation with runnable code. Browse the individual methods covered by this guide in the Iterators category. Key APIs covered include yield, Iterator.prototype.every(), Iterator.prototype.find(), Iterator.prototype.some(), Iterator.prototype.forEach(), Iterator.prototype.reduce(). Related guides: Arrays, Strings, Numbers, Math, Date. This is one of 145 JavaScript guides on JS Reference — see the full list on the guides page.