← Back to archive

Stdle #183 · scope · 2026-11-30

What does this JavaScript snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

class A { get x() { return "proto"; } }
const a = new A();
console.log(a.x);
Object.defineProperty(a, "x", { value: "own" });
console.log(a.x);
Scope
2 lines
4 attempts left

Answer & explanation