const target = { x: 1 }; const handler = { get(obj, prop) { return prop in obj ? obj[prop] : 0; } }; const p = new Proxy(target, handler); console.log(p.x, p.y);