Language concepts

Async generator function

Try the free JavaScript compiler

Creates an asynchronous generator with promise-returning iteration methods. The body may await values and suspend at yield.

Formal Syntax & Structure

javascript syntaxjavascript
async function* name() { yield value; }

Working Example

Example Snippetjavascript
async function* g(){yield 5;}(async()=>console.log((await g().next()).value))();
JavaScript Reference