liveBook · Manning

Dotted notation

As explained in D3.js in Action, Third Edition

Dot notation is JavaScript property access syntax that places a property name after an object and a period.

Dotted notation is JavaScript property access syntax: place a property name after an object and a period, as in row1.name. It reads values from objects and supports working with object-based datasets. section 1.2.5

Reading employee data

Given an employee object, row1.name returns "Zoe" and row1.works_with_d3 returns false. Bracket notation provides an alternative when a property name contains spaces or comes from a variable: row1[myProperty].

Arrays of objects commonly hold datasets. Inside forEach, map, filter, and find callbacks, dotted notation reaches each datum’s properties for conversion, extraction, selection, and lookup.

How D3.js in Action, Third Edition covers it

How deep it goes
Defines dotted access, contrasts bracket notation, and applies both within dataset iteration.
Examples
Uses employee objects, an employee dataset, property conversion, name extraction, filtering, and record lookup.
What it assumes
Assumes basic JavaScript values and arrays while teaching object-property access through concrete employee data.
What you can do after
Apply it via JavaScript to read and update object properties while iterating through datasets.
How it connects
Connects JavaScript objects with bracket notation, arrays, forEach, map, filter, find, and data wrangling.

Also explained in

Compare how 9 books explain dotted notation →

Related concepts

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