Public
Edited
Oct 24, 2023
3 stars
Insert cell
Insert cell
d3.mode([1, 2, 2, 2, 3, 3]) // 2
Insert cell
Insert cell
d3.mode(["5", 5, "5", "5", 5, 4, 4, 4, 4]) // 4
Insert cell
Insert cell
d3.mode(["5", 5, "5", "5", 5, 4, 4, 4, 4], Number) // 5
Insert cell
Insert cell
d3.mode(penguins, d => d.island)
Insert cell
Insert cell
{
let args; // the arguments to the last call of the accessor below: datum, index, data
d3.mode(penguins, (d, i, e) => { args = [d, i, e]; return d.species; });
return args;
}
Insert cell
Insert cell
d3.groupSort(penguins, v => v.length, d => d.island).pop()
Insert cell
Insert cell
d3.mode([1, undefined, undefined, NaN, NaN, NaN, null, null]) // 1
Insert cell
Insert cell
d3.groupSort([1, undefined, undefined, NaN, NaN, NaN, null, null], v => v.length, d => d).pop() // NaN
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more