let handler = { get: function (target, name) { return name in target ? target[name] : 42; }, }; let p = new Proxy({}, handler); p.a = 1; console.log(p.a, p.b); // 1, 42 この Proxy オブジェクトは target (ここでは空オブジェクト) と handler オブジェクトを定義し、その中に get トラップが実装されています。ここで、プロキシーとなったオブジェクトは未定義のプロパティを取得しようとした時に undefined を返さず、代わりに数値 42 を返します。 それ以外の例は Proxy のリファレンスページを参照してください。