JavaScript Object Property Descriptors
Any object in JavaScript has a set of properties, and each of these properties has a descriptor.
so let's know why you need this ?
- it's rare using but it uses for advance apps so they can keep the property privacy and not change it or deleted (configurable) OR escape it from for loops (enumerable), By default these values added using are immutable and not enumerable.
so you can change this way by using
Object.defineProperty(obj, 'key', descriptor)
Note :to define it and descriptor object should add all 4 values and define them if you don't it will assign other to false.
Top comments (0)