Javascript object has two types of properties: data properties and accessor properties.
Data properties contain a single location for a data value.
Values are read from and written to this location.
Data properties have four attributes describing their behavior:
Attribute | Default Value | Meaning |
---|---|---|
[[Configurable]] | true | Indicates if the property may be redefined by removing the property via delete, changing the property's attributes, or changing the property into an accessor property. |
[[Enumerable]] | true | Indicates if the property will be returned in a for-in loop. |
[[Writable]] | true | Indicates if the property's value can be changed. |
[[Value]] | undefined | Contains the actual data value for the property. This is the location from which the property's value is read and the location to which new values are saved. |
When a property is explicitly added to an object, [[Configurable]], [[Enumerable]], and [[Writable]] are all set to true while the [[Value]] attribute is set to the assigned value.
For example:
let person = { name: "HTML" };
Here, the property called name
is created and a value of "HTML" is assigned.
[[Value]] is set to "HTML".