Benjamin Vincent the magic part is that the for..of loop on a generator just consumes elements as long as there exists something. Which worker consumes a certain output of the generator is not predictable but all workers end when there’s nothing more to consume. That is how the for..of loop works with generators. Hope it helps.

Knowledge Worker, MSc Systems Engineering, Tech Lead, Web Developer

Love podcasts or audiobooks? Learn on the go with our new app.