As is the case with C# IEnumerables, JavaScript iterables are also based on the idea of suspending a computation and resuming it when a new value is required. More specifically, iterators and generator functions are the foundation of JavaScript iterables.
Iterators, iterables, and generators
Iterators and iterables
Iterators are interfaces (Iterator<T> ) that support a next() operation, which, in turn, returns the following generic interface:
interface IteratorResult<T>
{
done : boolean;
value : T
}
Where the done property must return true if, and only if, no more values are available in the iteration, and where the value property must contain the current element of the iteration. Being an interface, we are...