Public
Edited
Apr 4, 2023
Insert cell
Insert cell
Insert cell
{
// blocks
const someVariable = "Some value";
let anotherVar = ["List", "of", "values"];
}
Insert cell
{
// return data from a block
const pi = 3.1415;
return pi
}
Insert cell
Insert cell
{
// create a new Array with 365 items and replace all elements with a date
let days = [...new Array(365)].map((_, i) => new Date(2021, 0, i+1));
return days
}
Insert cell
// create an Array with 128 items
someArray = [...new Array(128)]
Insert cell
// replace all elements with "Test"
someArray.map(() => "Test")
Insert cell
Insert cell
Insert cell
[[1,2]].flat()
Insert cell
// flat multiple nested arrays
[[[[1,2,3,4]]]].flat(3)
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