Favorites

JavaScript Symbol.iterator Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Symbol.iterator
JavaScript Symbol Static propertyThis property is supported by all modern browsers.
Updated 28th November 2026

Symbol.iterator is the symbol used to make an object iterable. Define a method with this key and the object works with for...of and spread syntax.

Description

Symbol.iterator is a well-known symbol. An object becomes iterable when it has a method under this key that returns an iterator. Arrays, strings, maps and sets already have one, and that's what for...of, spread syntax, destructuring and Array.from() call. A generator function is the easiest way to write one.

The method must return an iterator: an object with a next() method that returns { value, done }. Defining it as a generator method, *[Symbol.iterator]() { ... }, creates that iterator for you. Each call should return a fresh iterator, so the object can be looped over more than once.

Symbol.asyncIterator is the asynchronous counterpart, used by for await...of. Checking typeof obj[Symbol.iterator] === 'function' is the standard way to test whether a value is iterable.

Syntax

Symbol.iterator

Value

A well-known symbol.

Example

const range = {
  from: 1, to: 4,
  *[Symbol.iterator]() {
    for (let n = this.from; n <= this.to; n++) yield n;
  },
};
console.log([...range]);
for (const n of range) console.log(n);

Browser Support

The following information will show you the current browser support for the Symbol.iterator property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee