TG Telegram Group & Channel
JavaScript | United States America (US)
Create: Update:

CHALLENGE

const obj = { name: 'Alice', age: 30 };  
const handler = {
get(target, prop) {
return prop in target ? target[prop] : `Property '${prop}' doesn't exist`;
}
};

const proxy = new Proxy(obj, handler);

const descriptors = Object.getOwnPropertyDescriptors(obj);
Reflect.defineProperty(obj, 'city', {
value: 'New York',
enumerable: false
});

console.log(proxy.city, proxy.country);

CHALLENGE

const obj = { name: 'Alice', age: 30 };  
const handler = {
get(target, prop) {
return prop in target ? target[prop] : `Property '${prop}' doesn't exist`;
}
};

const proxy = new Proxy(obj, handler);

const descriptors = Object.getOwnPropertyDescriptors(obj);
Reflect.defineProperty(obj, 'city', {
value: 'New York',
enumerable: false
});

console.log(proxy.city, proxy.country);


>>Click here to continue<<

JavaScript




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)