One column, and what happens at the edges
Failures with no error: d3.mean([]) is undefined, Math.max() is -Infinity, a plain reduce gives NaN, and d3.max on strings picks '910'.
Charts show summaries: totals, averages, the busiest day, counts per month, how many days fall in each range. d3-array gives short, tested functions for these, and you must know what each returns for empty, missing and text input.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Using daily.csv and d3.rollup, find the month with the most rides and print its name and total.
Write summary(values) that returns { count, min, median, max } and returns null for an empty array.
Explain it without notes
What does d3.mean([]) return, and what should a dashboard show then?
What is the difference between d3.group and d3.rollup?
Why can d3.sum be right and d3.max wrong on the same array of strings?
Preview
Console
Nothing logged yet.Expected console output
days: 365 | total rides: 933651
extent: [ 439, 4380 ] | mean: 2557.9 | median: 2484
busiest day: 2025-07-18 | quietest: 2025-08-14
middle half of days: 1702 to 3365
d3.sum([]) 0
d3.mean([]) undefined
d3.max([]) undefined
d3.extent([]) [, ]
d3.median([5]) 5
d3.mean([4, null, 8, NaN]) 6
d3.sum([4, null, 8, NaN]) 12
Math.max(...[]) -Infinity
[4, NaN, 8].reduce((a, b) => a + b) NaN
d3.max(['4380', '910']) 910