Want to get one value from a generator without running it all at once? Calling `next()` on its generator object starts or resumes execution. The generator runs until it reaches a `yield` or finishes, then `next()` returns an object with `value` and `done` properties. section 18.2
Start, pause, and send a value back
```js function* exchange(initial) { console.log('started'); const reply = yield initial; yield reply; return 'finished'; } const generator = exchange('a'); // Nothing logged yet. generator.next('ignored'); // Logs 'started'; { value: 'a', done: false } generator.next('b'); // { value: 'b', done: false } generator.next(); // { value: 'finished', done: true } ``` The first `next()` starts the halted generator; its argument is ignored because execution has not reached a `yield` to receive it. Use a generator-function parameter for an initial value. The next call supplies `'b'` as the result of the paused `yield`. On completion, `done` is `true`; a returned value appears in `value`, while simply reaching the end produces `undefined`. section 18.2
`next()` also defines an iterator’s basic job: produce the next value and signal when iteration is done. An object’s `Symbol.iterator` method can return an iterator with a `next()` method. Spread and `for..of` call that method repeatedly, stopping when `done` is `true`. A generator can serve as that iterator, avoiding a hand-written `next()` method. Don’t spread an infinite iterator: it never reports completion. section 23.4 section 23.5
Put the feedback loop to work
A simulation can call `next()` to obtain a contestant, then pass previous outcomes into a later `next()` call. The generator receives those outcomes at its paused `yield` and can use them to shape its next contestant. For practice, make an infinite date generator whose first `next()` yields today and whose later calls yield successive days. section 19.1 section 18.4
A method named `next()` is not always an iterator method. A sprite’s `next()` hook, for example, runs before each frame and returns the sprite itself—not a `{ value, done }` result. section 29.3




