1
JavaScriptIntermediate#es6#modules
An iterator exposes next() returning { value, done }. A generator function (function*) creates one automatically and can pause at each yield, which suits lazy sequences and custom iteration.
function* ids() { let i = 1; while (true) yield i++; }
const g = ids();
g.next().value; // 1
g.next().value; // 2