A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-140.ts
1function*gen():Generator<number>{yield3;yield4}
2constit=gen()
3console.log(it.next().value,[...it])
Modern
Answer & explanation
Console output
3 [ 4 ]
Why
A generator returns a single stateful iterator that advances as it is consumed. The first `next()` pulls `3`, leaving the iterator positioned after it, so spreading the same iterator collects only the remaining `4`. Iterators are not rewound, which is why mixing manual `next()` and spread on one instance yields a partial result.