Mid JavaScript

What are Proxies in JavaScript?

Proxy allows you to intercept and redefine fundamental operations on objects.

Example:

const user = { name: "Alice" };

const proxy = new Proxy(user, {

get: (target, prop) => `${prop} -> ${target[prop]}`

});

console.log(proxy.name); // name -> Alice

✅ Used in data validation, reactive frameworks (like Vue.js).

More from JavaScript Tutorial

All questions for this course