When `obj.contents = value` changes hidden state instead of storing `value`, the property is an accessor: reading or writing it executes code. This explains silent assignments, computed results, and unexpected side effects. section 5.2.2 section 5.2
An accessor descriptor uses `get` and `set`; it has no `value` or `writable` attributes. `enumerable` and `configurable` still govern visibility and descriptor changes. Object literals and `Object.defineProperty()` create different default attributes, so inspect unfamiliar behavior with `Object.getOwnPropertyDescriptor()`. section 5.2.3 section 5.2
Use these distinctions when reasoning about accessor behavior:
- A getter computes and returns a value when the property is read; a setter receives the assigned value and may update other state. section 5.2.2
- In a class, instance data fields are own properties, while accessors defined by the class are shared through the prototype. section 6.2.4
- Treat accessors deliberately: property syntax can conceal calculations, validation, mutation, or other observable work. section 5.2.2
Computed drawer contents
A getter reports the number of stored documents, while the setter appends a string rather than replacing a `contents` value. Reading `dynamicDrawer.contents` therefore changes from `3 documents` to `4 documents` after an assignment. section 5.2.2
Table 5.1 The property descriptor attributes and the property types they apply to:
|
Name
|
Description
|
Data Properties
|
Accessor Properties
|
|
[[Value]]
|
A stored JavaScript value
|
✓
|
|
|
[[Writable]]
|
A boolean indicating whether [[Value]] can be changed
|
✓
|
|
|
[[Get]]
|
Code used to compute the property value
|
|
✓
|
|
[[Set]]
|
Code used to modify the property value
|
|
✓
|
|
[[Enumerable]]
|
A boolean indicating whether the property can appear in iterations
|
✓
|
✓
|
|
[[Configurable]]
|
A boolean indicating whether the property descriptor itself can be
changed or deleted
|
✓
|
✓
|
Compare accessor attributes with data-property attributes, especially `get`/`set` versus `value`/`writable`. section 5.2

