Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
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 generator methods always yield Promise objects.
AsyncGenerator is a subclass of the hidden AsyncIterator class.
There's no JavaScript entity that corresponds to the AsyncGenerator constructor. Instances of AsyncGenerator must be returned from async generator functions:
There's only a hidden object which is the prototype object shared by all objects created by async generator functions. This object is often stylized as AsyncGenerator.prototype to make it look like a class, but it should be more appropriately called AsyncGeneratorFunction.prototype.prototype, because AsyncGeneratorFunction is an actual JavaScript entity. To understand the prototype chain of AsyncGenerator instances, see AsyncGeneratorFunction.prototype.prototype.
These properties are defined on AsyncGenerator.prototype and shared by all AsyncGenerator instances.
AsyncGenerator.prototype.constructorThe constructor function that created the instance object. For AsyncGenerator instances, the initial value is AsyncGeneratorFunction.prototype.
Note: AsyncGenerator objects do not store a reference to the async generator function that created them.
The initial value of the [Symbol.toStringTag] property is the string "AsyncGenerator". This property is used in Object.prototype.toString().
Also inherits instance methods from its parent AsyncIterator.
AsyncGenerator.prototype.next()Returns a Promise which will be resolved with the given value yielded by the yield expression.
AsyncGenerator.prototype.return()Acts as if a return statement is inserted in the generator's body at the current suspended position, which finishes the generator and allows the generator to perform any cleanup tasks when combined with a try...finally block.
AsyncGenerator.prototype.throw()Acts as if a throw statement is inserted in the generator's body at the current suspended position, which informs the generator of an error condition and allows it to handle the error, or perform cleanup and close itself.
The following example iterates over an async generator, logging values 1–6 to the console at decreasing time intervals. Notice how each time a Promise is yielded, but it's automatically resolved within the for await...of loop.
| ECMAScript® 2027 Language Specification # sec-asyncgenerator-objects |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.