Loading...

Post

Interview Question 🎯
What does this JavaScript code do?

      const user = { name: "John" };

const proxy = new Proxy(user, {
  get(target, prop) {
    return prop in target ? target[prop] : "Not found";
  }
});

console.log(proxy.name); // ?
console.log(proxy.age);  // ?