Standard built-ins

Iterator.from()

Try the free JavaScript compiler

Obtains an iterator from an iterable or iterator, wrapping it when needed to supply the standard helper interface.

Formal Syntax & Structure

javascript syntaxjavascript
Iterator.from(source)

Parameters & Attributes

NameTypeDescription
sourceIterable | IteratorSource sequence.

Return Value

Iterator

Helper-capable iterator.

Working Example

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