Generators and Iterators
generators returning Iterators that are also Iterables
We'll cover the following...
We'll cover the following...
Recall our string iterator example to refresh what iterable objects and iterators are:
Node.js
let message = 'ok';let stringIterator = message[Symbol.iterator]();
We call the next
method of stringIterator
to get the next element:
Node.js
console.log( stringIterator.next() );
However, before we learned about iterators, we used the ...