Standard built-ins

Iterator.prototype.toArray()

Try the free JavaScript compiler

Consumes remaining values into an ordinary array. Use finite sources or a meaningful bound.

Formal Syntax & Structure

javascript syntaxjavascript
iterator.toArray()

Return Value

Array

Result of the operation.

Working Example

Example Snippetjavascript
console.log(JSON.stringify(Iterator.from([5,6]).toArray()));
JavaScript Reference