JS Built-ins
Generatorbeginner

Generator: next() yields value

πŸ“– Usage Example
function* gen() { yield 1; yield 2 }
const it = gen()
console.log(it.next()) // β†’ { value: 1, done: false }
console.log(it.next()) // β†’ { value: 2, done: false }
console.log(it.next()) // β†’ { value: undefined, done: true }

A generator function returns a generator object that implements the iterator protocol via successive next() calls.

Check that next() yields the correct value.