JavaScript Reflect.defineProperty() MethodThe static method Reflect.defineProperty() allows the precise addition to or modification of a property on an object. The Reflect.defineProperty() method returns a Boolean value which indicates that whether or not the property was successfully defined. SyntaxParametertarget: It is the target object which defines the property. propertyKey: It is the name of the property to be defined or modified. Attributes: It is the attributes for the property being defined or modified. Return value:This method returns a Boolean value which indicates that whether or not the property was successfully defined. ExceptionsThis exception will throw a TypeError if the target is not an Object. Example 1Output: Object { } Example 2Output: Object { } true Example 3Output: "property1 created!" 42 12 Next TopicJavaScript Reflect |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India