JS: Property Attributes
Property Attributes
Each property has associated info called attribute.
Attributes of properties
value-
The property's value.
writable-
When
true, the property's value can be changed. enumerable-
When
true, the property shows in some enumeration constructs, such as for-in Loop. 〔see JS: List Properties〕 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 of Property Attributes
for objects created by Object Literal Expression:
writable→trueenumerable→trueconfigurable→true
for default Property Descriptor:
writable→falseenumerable→falseconfigurable→false
Show Property Attributes
Set Property Attributes
JavaScript. Property
- JS: Property Overview
- JS: Order of Properties
- JS: Property Key
- JS: Property Dot Notation vs Bracket Notation
- JS: Create Property
- JS: Delete Property
- JS: Get Set Property
- JS: Check Property Existence
- JS: Access Property
- JS: List Properties
- JS: for-in Loop ❌
- JS: Enumerable Property
- JS: Property Attributes
- JS: Property Descriptor
- JS: Getter / Setter Property
JavaScript. Define Properties and attributes.
- JS: Property Attributes
- JS: Enumerable Property
- JS: Property Descriptor
- JS: Object.create
- JS: Object.defineProperty ❌
- JS: Reflect.defineProperty
- JS: Object.defineProperties
- JS: Object.prototype.propertyIsEnumerable ❌
- JS: Object.getOwnPropertyDescriptor ❌
- JS: Reflect.getOwnPropertyDescriptor
- JS: Object.getOwnPropertyDescriptors