Skip to main content
Version: 3.27.2

Symbol.iterator

The well-known Symbol.iterator symbol specifies the default iterator for an object. Used by for...of.

Value

The well-known symbol Symbol.iterator.

Description

Whenever an object needs to be iterated (such as at the beginning of a for...of loop), its Symbol.iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.

Some built-in types have a default iteration behavior, while other types (such as Object) do not. The built-in types with a Symbol.iterator method are:

See also Iteration protocols for more information.