Stdle #18 · classes · 2026-06-24
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
1class P { constructor(public a: number, b: number, readonly c: number) {} }2console.log(Object.keys(new P(1, 2, 3)).join(','));
Console output
Why
A constructor parameter becomes an instance property only if it carries an access/readonly modifier. b has no modifier, so it is a plain local parameter and produces no this.b assignment. Object.keys therefore reports just a and c.