JS: Property Attributes
Property attributes
Each property has associated info called attributes. Each attribute is a name-and-values pair.
List of attributes
value-
The property's value.
writable-
When
true, the property's value can be changed. enumerable-
When
true, the property is included in some enumeration constructs, such as Object.keys. Else, the property is excluded. configurable-
If
true, then:- Property can be deleted.
- Property attributes can be changed. (e.g. Make it configurable again),
- Property can be changed from or to getter setter.
If
false, none of the above. You may still change the value ifwritableis true.
Attributes for getter setter
Default values
for objects created by Object Literal Expression:
writable→trueenumerable→trueconfigurable→true
for default Property Descriptor:
writable→falseenumerable→falseconfigurable→false