Reflect.set()
The static Reflect.set() method works like setting a
property on an object.
Syntax
Reflect.set(target, propertyKey, value)
Reflect.set(target, propertyKey, value, receiver)
Parameters
target- : The target object on which to set the property.
propertyKey- : The name of the property to set.
value- : The value to set.
receiveroptional- : The value of
thisprovided for the call to the setter forpropertyKeyontarget. If provided andtargetdoes not have a setter forpropertyKey, the property will be set onreceiverinstead.
- : The value of
Return value
A Boolean indicating whether or not setting the property was successful.
Exceptions
A TypeError, if target is not an
Object.
Description
The Reflect.set method allows you to set a property on an object. It does
property assignment and is like the
property accessor syntax as a function.