Computed property
A computed property is a property whose value is derived from other data when accessed rather than stored as an independent value.
Secrets of the JavaScript Ninja, Second Edition
A property whose value is derived on access or assignment rather than stored as an independent data field.
- How it is used
- Represents a value derived from object state as a property accessed through a getter and, optionally, changed through a setter.
- How deep it goes
- Explains getter concatenation and setter splitting into underlying properties, covering both reads and writes.
- Examples
- Uses a shogun’s fullTitle, derived from name and clan and assigned by splitting a title string.
- What you can do after
- Evaluate/understand how to expose derived object state as a property and map assignments back to its component properties.
Read how Secrets of the JavaScript Ninja, Second Edition explains computed property →
Building User-Friendly DSLs
A class property whose value is derived when accessed rather than stored as an independently assigned value.
- How it is used
- Derives a read-only rental amount for display while reflecting changes to rental price and discount inputs.
- How deep it goes
- Defines JavaScript getters, demonstrates placeholder and final formulas, and connects access to formatted JSX output.
- Examples
- Uses Rental, rentalPriceBeforeDiscount, discount, rentalPriceAfterDiscount, and a formatted rental form field.
- What you can do after
- Apply it via a JavaScript getter to derive and display a rental amount without accepting direct edits.
Read how Building User-Friendly DSLs explains computed property →
Related concepts
- accessor methodimplemented by · An accessor method or function provides access to an object's property or state by retrieving its value, assigning a value, or defining behavior for such access.
- setterimplemented by · A setter is an accessor function associated with an object property that is invoked when a value is assigned to that property.
- attributekind of · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- getterimplemented by · A property accessor that executes code and returns a value when the property is read.
- computed property namecontrasts with · A computed property name is a syntax form in which an object or class property key is determined by evaluating an expression.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

