A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-133.ts
1classC{count=0;getnext(){return++this.count;}}
2constc=newC();
3console.log(c.next,c.next,c.next);
Classes
Answer & explanation
Console output
1 2 3
Why
A getter can have side effects: next runs ++this.count on every read. Because property access invokes the accessor each time, the three reads return 1, 2, and 3 as count climbs. The arguments to console.log are evaluated left to right.