nextbeginnerfunction* 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 done is true after all yields.