A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-165.ts
1classM{
2staticbase=10;
3staticderived=M.base*2;
4static{M.base=99;}
5}
6console.log(M.base,M.derived);
Classes
Answer & explanation
Console output
99 20
Why
Static initializers run once, in order: `derived` reads `base` while it is still 10 and stores 20, then the later static block reassigns `base` to 99 without re-evaluating derived. A derived static value captures the source value at its initialization moment, not lazily. Hence 99 and 20.