A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-145.ts
1classC{
2privatex=1;
3#x=2;
4sum(){returnthis.x+this.#x;}
5}
6constc=newC();
7console.log((casany).x,c.sum());
Classes
Answer & explanation
Console output
1 3
Why
A `private x` and a `#x` are entirely separate: the first is a normal property named "x", the second a hidden private slot, so they never collide. A cast can read the visible "x" (1) but cannot reach `#x`. Inside the class, `sum()` reads both, producing 1 + 2 = 3.