Published
Edited
Jun 3, 2020
Insert cell
md`# Five Minute Introduction Tutorial`
Insert cell
2 * 3 * 7
Insert cell
{
let sum = 0;
for (let i = 0; i <= 100; ++i) {
sum += i;
}
return sum;
}
Insert cell
color = "orange";
Insert cell
`My favorite color is ${color}.`
Insert cell
html`<span style="background:yellow;">
My favorite language is <i>HTML</i>
</span>`
Insert cell
md`My favorite language is *Markdown*`
Insert cell
html`My favorite color is <i style="background:${color};">${color}</i>.`
Insert cell
status = new Promise(resolve => {
setTimeout(() => {
resolve({resolved: new Date});
}, 2000);
})
Insert cell
d3 = require("d3-fetch@1")
Insert cell
countries = (await d3.tsv("https://cdn.jsdelivr.net/npm/world-atlas@1/world/110m.tsv"))
.sort((a, b) => b.pop_est - a.pop_est) // Sort by descending estimated population.
.slice(0, 10) // Take the top ten.
Insert cell
i = {
let i = 0;
while (true) {
yield ++i;
}
}
Insert cell
`The current value of i is ${i}.`
Insert cell
date = {
while (true) {
yield new Promise(resolve => {
setTimeout(() => resolve(new Date), 1000);
});
}
}
Insert cell
slider = html`<input type=range>`
Insert cell
sliderValue = Generators.input(slider)
Insert cell
import {viewof selection as cars} from "@d3/brushable-scatterplot"
Insert cell
viewof cars
Insert cell
cars
Insert cell
md`${Array.from(new Set(cars.map(c => c.name)))
.sort()
.map(c => `* <a target="_blank" href="https://google.com/search?tbm=isch&q=${escape(c)}">${c}</a>`)
.join("\n")}`
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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