Languages / JavaScript Core
Iteration and Generators
Iterators, generators, async iteration, and iterator helpers.
Iterators in JavaScript
Iterators expose a uniform way to walk values one step at a time, whether the source is an array, a map, or a custom sequence. This chapter covers the iterator and iterable protocols, for..of, and when manual next() beats a loop.
Generators in JavaScript
Generator functions pause at yield and resume on next(), which makes them the standard way to build iterators without manual state. This chapter covers two-way yield, for..of, yield*, and early completion with return and throw.
Async iterators and for await..of
Async iterables produce values that may arrive after await, which fits streams, paginated APIs, and backpressure-friendly pipelines. This chapter covers Symbol.asyncIterator, async generators, and for await..of consumption.
Iterator helpers
ES2025 adds lazy iterator objects with map, filter, take, and related helpers so you can chain sequence operations without copying arrays. This chapter covers Iterator.from, chaining, and when helpers beat array methods.