Standard built-ins

AsyncGenerator.prototype.next()

Try the free JavaScript compiler

Queues a request to resume an async generator and returns a promise for the next iteration result.

Formal Syntax & Structure

javascript syntaxjavascript
asyncGenerator.next([value])

Parameters & Attributes

NameTypeDescription
valueanyOptional resumption, completion or error value.

Return Value

Promise<IteratorResult>

Promise for the iteration result.

Working Example

Example Snippetjavascript
async function* g(){try{yield 1;}catch(e){yield e.message;}}(async()=>{const i=g();console.log((await i.next()).value);})();
JavaScript Reference