Array.prototype[Symbol.iterator]()
The Symbol.iterator
method of an Array
object implements the iterable protocol and allows arrays to be consumed by most syntaxes expecting iterables, such as the spread syntax and for...of
loops. It returns an iterator that yields the value of each index in the array.
The initial value of this property is the same function object as the initial value of the Array.prototype.values
property.
Syntax
array[Symbol.iterator]()
Return value
The same return value as Array.prototype.values()
: a new iterable iterator object that yields the value of each index in the array.