const GeneratorFunction = function* () {}.constructor; const foo = new GeneratorFunction(` yield 'a'; yield 'b'; yield 'c'; `); let str = ''; for (const val of foo()) { str = str + val; } console.log(str); // Expected output: "abc"