A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-178.js
1constobj={
2vals:[5,6],
3*gen(){for(constvofthis.vals)yieldv;},
4};
5console.log([...obj.gen()].join(','));
Async
Answer & explanation
Console output
5,6
Why
A generator method invoked as obj.gen() has its this bound to obj, just like any normal method call. Inside the generator, this.vals reads the object’s array, and the loop yields each element. Spreading the result gives [5, 6].