Language concepts

Iterable protocol

Try the free JavaScript compiler

An iterable provides an iterator through this method. Spread and for...of consume its iteration results. A repeatable source can create a new iterator each time.

Formal Syntax & Structure

javascript syntaxjavascript
source[Symbol.iterator]()

Working Example

Example Snippetjavascript
console.log(JSON.stringify([...new Set([3,3,4])]));
JavaScript Reference