JS Built-ins
Generatoryieldbeginner

Generator: yield for...of

πŸ“– Usage Example
function* gen() {
  const x = yield 'ready?'
  yield x * 2
}
const it = gen()
it.next()       // β†’ { value: 'ready?', done: false }
it.next(5)      // β†’ { value: 10, done: false }

The yield expression pauses the generator and optionally receives a value passed to the next next() call.

Check that for...of works with generator.