AsyncGenerator - JavaScript | MDN

developer.mozilla.org

Tin mới

HTML: Markup language

See all HTML references

Date & time formats

See all HTML guides

CSS: Styling language

See all CSS references

See all CSS guides

Centering an element

JavaScript: Scripting language

Standard built-in objects

Expressions & operators

Statements & declarations

See all JavaScript references

Control flow & error handing

Loops and iteration

Working with objects

See all JavaScript guides

Web APIs: Programming interfaces

Service worker API

Using the Web animation API

Using the Fetch API

Working with the History API

Using the Web speech API

All web technology

Progressive web apps

Learn web development

Getting started modules

Structuring content with HTML module

CSS styling basics module

Dynamic scripting with JavaScript module

Border-image generator

Border-radius generator

Box-shadow generator

Color format converter

async generator function

The AsyncGenerator object is returned by an async generator function and it conforms to both the async iterable protocol and the async iterator protocol.

async iterable protocol and the async iterator protocol

The AsyncGenerator object is returned by an async generator function and it conforms to both the async iterable protocol and the async iterator protocol.

AsyncGeneratorFunction.prototype.prototype

There's no JavaScript entity that corresponds to the AsyncGenerator constructor. Instances of AsyncGenerator must be returned from async generator functions:

AsyncGenerator.prototype.constructor

The constructor function that created the instance object. For AsyncGenerator instances, the initial value is AsyncGeneratorFunction.prototype.

AsyncGeneratorFunction.prototype

The constructor function that created the instance object. For AsyncGenerator instances, the initial value is AsyncGeneratorFunction.prototype.

[Symbol.toStringTag]

The initial value of the [Symbol.toStringTag] property is the string "AsyncGenerator". This property is used in Object.prototype.toString().

Object.prototype.toString()

The initial value of the [Symbol.toStringTag] property is the string "AsyncGenerator". This property is used in Object.prototype.toString().

AsyncGenerator.prototype.next()

Returns a Promise which will be resolved with the given value yielded by the yield expression.

AsyncGenerator.prototype.return()

Returns a Promise which will be resolved with the given value yielded by the yield expression.

AsyncGenerator.prototype.throw()

Returns a Promise which will be resolved with the given value yielded by the yield expression.

function* expression

Generator Function

Iterators and generators

Learn how to contribute

This page was last modified on Jul 10, 2025 by MDN contributors.

[Symbol.asyncDispose]()

[Symbol.asyncIterator]()