Language concepts

Async iterable protocol

Try the free JavaScript compiler

Supplies an asynchronous iterator. Its next returns a promise for an iterator result. for await...of consumes the protocol and can also adapt synchronous iterables.

Formal Syntax & Structure

javascript syntaxjavascript
source[Symbol.asyncIterator]()

Working Example

Example Snippetjavascript
async function* g(){yield 1;}console.log(typeof g()[Symbol.asyncIterator]);
JavaScript Reference