JS Built-ins
Generatornextbeginner

Generator: next() basic

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

generator.next() advances the generator to the next yield and returns an object with value and done properties.

Check that next() returns the correct value and done.