A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-96.ts
1classCounter{
2static#n=0;
3static{Counter.#n=5;}
4staticgetvalue(){returnCounter.#n;}
5}
6console.log(Counter.value);
Classes
Answer & explanation
Console output
5
Why
Static blocks share the class`s private namespace, so they can read and write static `#private` fields that ordinary outside code cannot touch. The block sets `#n` to 5 once at definition time, and the static getter exposes it. This pattern encapsulates static state behind an accessor.