The Symbol.asyncIterator static data property represents the well-known symbol specifying the method that returns the async iterator for an object. If this property is set on an object, it is an async iterable and can be used in a for await...of loop.

Try it


The well-known symbol @@asyncIterator.

Property attributes of Symbol.asyncIterator
Writable no
Enumerable no
Configurable no


The Symbol.asyncIterator symbol is a builtin symbol that is used to access an object's @@asyncIterator method. In order for an object to be async iterable, it must have a Symbol.asyncIterator key.


User-defined async iterables

You can define your own async iterable by setting the [Symbol.asyncIterator] property on an object.

const myAsyncIterable = {
  async *[Symbol.asyncIterator]() {
    yield "hello";
    yield "async";
    yield "iteration!";

(async () => {
  for await (const x of myAsyncIterable) {
// Logs:
// "hello"
// "async"
// "iteration!"

When creating an API, remember that async iterables are designed to represent something iterable — like a stream of data or a list —, not to completely replace callbacks and events in most situations.

Built-in async iterables

ReadableStream is the only built-in JavaScript object that has the Symbol.asyncIterator method set by default at the time of writing.


ECMAScript Language Specification
# sec-symbol.asynciterator

Browser compatibility

BCD tables only load in the browser

See also