blob: 2a5f927f656b89db00956d1ed5294296ea326838 (
plain)
1
2
3
4
5
6
7
8
9
10
|
// Return the trap result
// Man, wouldn't haskell's "uninfix" be cleaner? (+)
function justAdd(x, y) {
return x + y;
}
var handler = { apply : function (target, receiver, args) { return args[0] * args[1]; } };
for (let p of [new Proxy(justAdd, handler), Proxy.revocable(justAdd, handler).proxy])
assertEq(p(2,3), 6);
|