JavaScript: Reflect.defineProperty

By Xah Lee. Date: . Last updated: .

New in JS2015.

Reflect.defineProperty( obj, key, descriptor )
Create/modify a property's attributes. descriptor is Property Descriptor. Return true if successful, else false. Similar to Object.defineProperty.
const u = {};

const result = Reflect.defineProperty(u, "p",
{ value : 3,
  writable: true,
  enumerable: true,
  configurable: true
}
);

console.log( u ); // { p: 3 }

// return value is true/false
console.log( result ); // true
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Reflect