I try to understand Generators, but I found an example which I can not follow.
// First Generator
function* Colors ()
yield* MoreColors ();
// Generator refered by the first Generator
function* MoreColors ()
// Let us iterate over the first Generator
const colorIterator = Colors();
while (!(color = colorIterator.next()).done)
The problem is that the generator Colors does not stop once MoreColors stops. After MoreColors is done, the execution of Colors continues from where it stopped, and so it would return "green" before being done. That's because the generator does not "become" MoreColors, but rather returns its answers, and the .next() method is still called on Colors.