The methods of class Iterator
let us process data incrementally. Let’s explore where we can use them.
Iterator.from(iterable)
always returns instances ofIterator
(converting non-instances to instances as needed).iterable[Symbol.iterator]()
returns an iterator:- With all built-in data structures, the result is an instance of
Iterator
. - With other, older iterable objects, the result may not be an instance of
Iterator
.
- With all built-in data structures, the result is an instance of