JS: Property Attributes

By Xah Lee. Date: . Last updated: .

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 if writable is true.

Attributes for getter setter

Default Values of Property Attributes

for objects created by Object Literal Expression:

for default Property Descriptor:

Show Property Attributes

Set Property Attributes

JavaScript. Property

JavaScript. Define Properties and attributes.