JavaScript Tutorial

Proxy Object

Intercepts and defines custom behavior for fundamental operations (e.g., property lookup, assignment).

const handler = {
  get: (target, prop) => prop in target ? target[prop] : 42
};
const proxied = new Proxy({}, handler);
console.log(proxied.answer); // 42