07. Generators Composition
function* foo() {
yield "a";
yield "b";
}
function* bar() {
yield "x";
yield* foo();
yield "y";
}
const arr = [...bar()];
// ['x', 'a', 'b', 'y']function* bar() {
yield "x";
for (const value of foo()) {
yield value;
}
yield "y";
}Last updated