liveBook · Manning

JavaScript

As explained in D3.js in Action, Third Edition

A high-level programming language standardized as ECMAScript and commonly executed in web browsers and JavaScript runtimes.

JavaScript is a high-level programming language used by D3 projects. D3 adds methods to JavaScript, so existing language features remain available alongside D3's API. section 1.2.5

This practical introduction focuses on method chaining and object manipulation. Method chaining passes an updated object through successive calls, keeping ordered transformations concise and readable. section 1.2.5

d3.selectAll("div")
  .append("p")
    .attr("class", "my-class")
    .text("Wow")
  .append("span")
    .text("Even More Wow")
    .style("font-weight", "900");

Follow a D3 selection as it appends paragraphs and spans, assigns attributes and text, and applies styling through one readable chain. section 1.2.5

Object manipulation supplies the data-handling patterns used alongside D3:

  • Index arrays, inspect their length, and test membership with includes(). section 1.2.5
  • Read object properties with dot or bracket notation, including dynamically selected property names. section 1.2.5
  • Transform, select, and search datasets with forEach(), map(), filter(), and find(). section 1.2.5

How D3.js in Action, Third Edition covers it

How deep it goes
Explains method chaining and object manipulation with examples, while deferring a full JavaScript introduction.
Examples
Uses chained D3 selections, arrays of values, employee objects, and map, filter, find, and forEach operations.
What it assumes
Assumes some prior JavaScript experience while teaching method chaining and object manipulation directly.
What you can do after
Apply JavaScript through D3 method chains and common array and object operations.
How it connects
Connects JavaScript with D3, the DOM, arrays, objects, and dataset transformation.

Also explained in

Compare how 12 books explain JavaScript →

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.