Published
Edited
Oct 13, 2021
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
styledDiv(
"color: cornflowerblue; border: 1px solid lightgray; border-radius: 5px; margin: 20px; padding: 5px;",
html`Example`
)
Insert cell
Insert cell
Insert cell
scrollableDiv(
120,
html`<span style="font-size: 50px">Large text that would take too much space in the notebook and is therefore better put into a scrollable container</span>`
)
Insert cell
Insert cell
Insert cell
scrollXDiv(
html`<div style="width: ${width + 35}px; text-align: right;">Hi!</div>`
)
Insert cell
Insert cell
Insert cell
background("cornflowerblue", html`Example`)
Insert cell
Insert cell
Insert cell
border("2px solid cornflowerblue", html`Example`)
Insert cell
Insert cell
Insert cell
grid(
"1fr 1fr 1fr",
"",
"20px",
"<div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>6</div>"
)
Insert cell
Insert cell
Insert cell
Insert cell
{
let i = 0;
yield i;
while (true) {
await delay(1000);
yield ++i;
}
}
Insert cell
Insert cell
Insert cell
unique([1, 2, 3, 1, 3, 4, 5])
Insert cell
unique([{ a: 1 }, { a: 1 }, { a: 2 }])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const array = get2dArray(5, 5, (row, col) => Math.random() * 10);
return print2dArray(array, (d) => d.toFixed(1));
}
Insert cell
Insert cell
{
const array = get2dArray(100, 100, (row, col) => row * 100 + col);
return print2dArray(array);
}
Insert cell
{
const array = get2dArray(5, 100, (row, col) => row * 5 + col);
return print2dArray(array, undefined, false);
}
Insert cell
Insert cell
Insert cell
normalizeNdArray([1, 2, 3, 4])
Insert cell
normalizeNdArray([
[
[1, 2],
[3, 4]
],
[
[1, 2],
[3, 4]
]
])
Insert cell
Insert cell
Insert cell
matrixColumnSum([
[1, 2],
[3, 4]
])
Insert cell
Insert cell
Insert cell
matrixColumnMedian([
[1, 2, 7],
[4, 5, 6],
[3, 8, 9]
])
Insert cell
Insert cell
Insert cell
Insert cell
getColorLightness("hsl(0, 100%, 42%)")
Insert cell
exampleColor = `rgb(${~~(255 * Math.random())}, ${~~(
255 * Math.random()
)}, ${~~(255 * Math.random())})`
Insert cell
Insert cell
getColorLightness(
exampleColor
)
Insert cell
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