Skip to main content
Version: 3.27.2

Set.prototype[Symbol.iterator]()

The [Symbol.iterator method of a Set object implements the iterable protocol and allows sets to be consumed by most syntaxes expecting iterables, such as the spread syntax and for...of loops. It returns an iterator that yields the values of the set.

The initial value of this property is the same function object as the initial value of the Set.prototype.values property.

Syntax

set[Symbol.iterator]()

Return value

The same return value as Set.prototype.values(): a new iterable iterator object that yields the values of the set.