Javatpoint Logo
Javatpoint Logo

JavaScript handler.defineProperty() Method

The handler.defineProperty() method can define the new properties. It can also modify the existing properties directly on an object. It is trap for Object.defineProper(). This method can be used in two situations.

  1. When we wanted to ensure cross-browser support of getters and setters.
  2. Whenever we want to define a custom property accessor.



Target: The target object.

Property: Retrieved property description.

Descriptor: The property being defined or modified.

Return value

This method returns a Boolean

Browser Support

Chrome 49
Edge 12
Firefox 18
Opera 36

Example 1

Test it Now


[object Object]

Example 2

Test it Now


in defineProperty

Example 3

Test it Now


Learn Java Script Proxt Method

Next TopicJavaScript handler

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA