{
a: 1,
b: 2,
c: ? // a + b
}
const obj = {
a: 69,
b: 187,
get c() {
return this.a + this.b;
},
};
const obj = new Proxy({ a: 69, b: 187 }, {
get(target, key) {
return (
key === 'c' ? target.a + target.b :
key === 'd' ? target.a * target.b :
key === 'e' ? target.a - target.b :
target[key]
);
},
});