Published
Edited
Sep 19, 2020
Insert cell
Insert cell
6 * 5
Insert cell
{
var subs = 0;
for (var j = 0; j <= 100; ++j) {
subs -= j;
}
return subs;
}
Insert cell
Insert cell
color = "Black"
Insert cell
`My favorite color is ${color}.`
Insert cell
Insert cell
html`<span style="background:purple;">
My favorite language is <i>HTML</i>.
</span>`
Insert cell
Insert cell
md`My favorite language is *C++*.`
Insert cell
Insert cell
html`My favorite color is <i style="background:${color};">${color}</i>.`
Insert cell
Insert cell
state = new Promise(resolu => {
setTimeout(() => {
resolu({resolu: new Date});
}, 2000);
})
Insert cell
Insert cell
state
Insert cell
Insert cell
newd3 = require("d3-fetch@1")
Insert cell
Insert cell
newcountries = (await newd3.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(43,55) // Take a range.
Insert cell
Insert cell
j = {
let j = 1;
while (true) {
yield ++j;
}
}
Insert cell
`The current value of i is ${j}.`
Insert cell
Insert cell
newdate = {
while (true) {
yield new Promise(resolu => {
setTimeout(() => resolu(new Date), 1000);
});
}
}
Insert cell
Insert cell
newslider = html`<input type=range>`
Insert cell
sliderValue = Generators.input(newslider)
Insert cell
Insert cell
viewof newvalue = html`<input type=range>`
Insert cell
newvalue
Insert cell
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

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