I'm having trouble with the Proxy() object in Javascript.
This code is working as expected when I pass in a target and no handler:
const scope = new Proxy({a: 2, b: 2}, {});
with (scope) {
a + b;
}
However, when I pass in a handler and no target, it does not work:
const scope = new Proxy({}, {get: function(){ return 2; }});
with (scope) {
a + b;
}
scope.a == 2 && scope.b == 2 evaluates to true in both cases.