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