Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptProxy and ReflectSingle-choice MCQ

Why is passing the receiver to Reflect.get important when forwarding a `get` trap over an object with getters?

const target = { _x: 10, get x() { return this._x; } }; const p = new Proxy(target, { get(t, key, receiver) { return Reflect.get(t, key, receiver); } }); console.log(p.x);