DEV Community

Cover image for Object.defineProperty & Getters , Setters in JavaScript
CodeWellTechYT
CodeWellTechYT

Posted on • Updated on

Object.defineProperty & Getters , Setters in JavaScript

DefineProperty of an Object is one of the very important and very useful method to know.

You can configure the object in a way you want.

You can restrict the user from modifying the object property value.

There important terms you must know about defineProperty method

configurable
true if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. Defaults to false.

enumerable
true if and only if this property shows up during enumeration of the properties on the corresponding object. Defaults to false.

writable
true if the value associated with the property may be changed with an assignment operator. Defaults to false.

Getter & Setter

image

Watch the video for detailed explanation

Top comments (0)