Closed jajaperson closed 3 years ago
Using generator functions means that an iterable can only be used once. To demonstrate
function* generator() { let index = 0; while (true) { yield index++; } } const g = generator() g.next().value // 0 g.next().value // 1 g[Symbol.iterator]().next().value // 2
Instead, methods should be generator functions that return an object with the iterable protocol.
Using generator functions means that an iterable can only be used once. To demonstrate
Instead, methods should be generator functions that return an object with the iterable protocol.