JavaScript
const obj = { name: 'John' };
Reflect.set(obj, 'age', 30);
console.log(Reflect.get(obj, 'name'));Output
John
Reflect API provides meta-programming operations.
Use Reflect API
const obj = { name: 'John' };
Reflect.set(obj, 'age', 30);
console.log(Reflect.get(obj, 'name'));John
Reflect API provides meta-programming operations.