JS: Property Attributes, writable, enumerable, configurable

By Xah Lee. Date: . Last updated: .

Property Attributes

Each property has associated info called attribute.

ECMAScript® 2016 Language Specification#sec-property-attributes

Data Property Attributes

Data Property Attributes
attribute namemeaning
value The property's value.
writable When true, the property's value can be changed.
enumerable When true, the property shows in some loop constructs, such as for-in Loop. [see JS: Access Property]
configurable If false, attempts to delete the property, change the property to be an accessor property, or change its attributes (other than [[Value]], or changing [[Writable]] to false) will fail.

Accessor Property's Attributes

JS: Getter/Setter Properties

[see JS: Property Overview]

Show Property Attributes

check Property's Enumerable Attribute

One convenient function is obj.propertyIsEnumerable(p).

JS: Object.prototype.propertyIsEnumerable

Set Property Attributes

JS: Object.defineProperty

Set Multiple Properties Attributes

JS: Object.defineProperties

JS Object Property Topic

  1. JS: Property Overview
  2. JS: Property Key
  3. JS: Property Dot Notation / Bracket Notation
  4. JS: Create/Delete Property
  5. JS: Get Property, Set Property
  6. JS: Check Property Existence
  7. JS: Access Property
  8. JS: Property Attributes, writable, enumerable, configurable
  9. JS: Getter/Setter Properties
  10. JS: Property Descriptor
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.