What is the output of the following? “`js const handler = { apply(target, thisArg, args) { return target.apply(thisArg, args) * 2; } }; const double = new Proxy(x => x + 1, handler); console.log(double(5)); “`
Key points
- The Proxy handler modifies the behavior of the original function by doubling its output.
- The `double` Proxy is created with a handler that applies the specified logic to the original function.
- The `double(5)` call results in the original function returning 6, which is then doubled to 12.
Ready to go further?
