d3.merge([1,[2,3]])// 🕷 the number 1 is not iterable
[
0,
[1],
[2,3],
[[4],[5]],
[[[6,7]],[[[8]]]],
[[[[[[[[["into the abyss"]]]]]]]]]
].flat(+depth)
lyrics=[
"If my words did glow with the gold of sunshine",
"And my tunes were played on the harp unstrung",
"Would you hear my voice come through the music",
"Would you hold it near as it were your own?"
]
lyrics.flatMap(d=>d.split(/\s+/))
a=Float32Array.from({length:10},(_,i)=>-i*i)
b=Float32Array.from({length:10},(_,i)=>i*i)
d3.merge([a,b])// flattens typed arrays
[a,b].flat()// 🕷 doesn’t flatten typed arrays
[a,b].flatMap(d=>Array.from(d))// explicit type conversion
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.