liveBook · Manning

Configurable property

As explained in Secrets of the JavaScript Ninja, Third Edition

A configurable property is an object property whose definition may be changed or deleted when its configurable attribute is true.

A property's configurable attribute determines whether its definition can be changed or deleted. It defaults to false; setting it to true allows the property to be overwritten or deleted. section 9.1.2

const obj = {};
Object.defineProperty(obj, "claim", {
  configurable: true,
  get() {
    return "This object belongs to the Uchiha Clan!";
  },
});

delete obj.claim;
obj.claim = "This object belongs to the Hyuga Clan now!";

This example defines a configurable getter, deletes it, then assigns a new value to the property. section 9.1.2

How Secrets of the JavaScript Ninja, Third Edition covers it

How deep it goes
Defines the false default and its consequences, then contrasts them with configurable properties across accessor and data descriptors.
Examples
Demonstrates deleting a configurable getter property, then assigning a replacement value.
What you can do after
Apply it via Object.defineProperty to make a property deletable or redefinable.
How it connects
Links configurable to Object.defineProperty, accessor descriptors, and data descriptors.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Third Edition. The section links point to the parts of the book it draws on.