JavaScript Object.defineProperty() MethodThe Object.defineProperty() method defines a new property directly on an object and returns the object. To change the flags, we can use Object.defineProperty. We cannot change it back, because define property doesn?t work on non-configurable properties. Syntax:ParameterObj: The Object on which to define the property. Prop: The name of a property to be defined or modified. Descriptor: The descriptor for the property being defined or modified. Return:This method returns the object that was passed to the function. Browser Support:
Example 1Output: 22 Example 2Output: 542 Example 3Output: 17 Next TopicJavaScript Objects |
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