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<<