liveBook · Manning

[[Value]]

As explained in JavaScript in Depth

An internal slot in a JavaScript property descriptor that holds the stored value of a data property.

A surprising assignment often becomes obvious once the property’s internal shape is named: a data property stores its value in [[Value]], while an accessor property computes it through [[Get]] and [[Set]]. These property kinds are mutually exclusive. section 5.2

At the language level, assigning to a data property replaces the exact value held by [[Value]], and reading the property returns that value without computation or side effects. Engines may use different physical storage, but the specification model remains [[Value]]. section 5.2.1

Direct replacement

For a drawer object with contents: 'tax documents', reading drawer.contents returns that string; assigning drawer.contents = 'invoices' replaces the stored value. The property behaves as data storage rather than computed access. section 5.2.1

Use these distinctions when inspecting descriptor behavior:

  • Treat [[Value]] and [[Writable]] as data-property attributes. section 5.2
  • Do not combine [[Value]] with [[Get]] or [[Set]]; accessor properties use the latter pair instead. section 5.2
  • Separate the specification model from engine storage mechanisms such as those used by V8. section 5.2.1
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 [[Value]] with [[Writable]], [[Get]], [[Set]], [[Enumerable]], and [[Configurable]] across data and accessor properties. section 5.2

How JavaScript in Depth covers it

How deep it goes
Defines direct storage and contrasts it with accessors, while stopping short of engine-specific storage internals.
Examples
Uses a drawer object whose contents value changes from tax documents to invoices.
What it assumes
Assumes basic JavaScript objects and properties while establishing data and accessor properties from their descriptor attributes.
What you can do after
Diagnose whether a property stores a value directly or computes access through descriptor attributes.
How it connects
Connects property descriptors with data properties, accessor properties, [[Writable]], [[Get]], and [[Set]].

Related concepts

This explainer was generated by Manning's knowledge graph from the text of JavaScript in Depth. The section links point to the parts of the book it draws on.