JS: Property Attributes

By Xah Lee. Date: . Last updated: .

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

Attributes for getter setter

Default values

for objects created by Object Literal Expression:

for default Property Descriptor:

Show property attributes

Set property attributes