Public
Edited
Jul 28, 2024
1 star
Insert cell
Insert cell
Insert cell
function foo() {
let bar = "foo";
return bar;
}
Insert cell
Insert cell
async function asyncFoo() {
let bar = "asyncFoo";
return bar;
}
Insert cell
Insert cell
foo()
Insert cell
asyncFoo()
Insert cell
Insert cell
bar = async (str) => {
let foo = str;
return foo;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
aMap = ƒaMap()
Insert cell
function ƒaMap() {
let m = new Map(),
i = 0;
for (const value of [1, 2, 3, 4]) {
m.set(value, i++);
}
return m;
}
Insert cell
Insert cell
aMapArrow = ƒaMapArrow()
Insert cell
ƒaMapArrow = () => {
let m = new Map(),
i = 0;
for (const value of [1, 2, 3, 4]) {
m.set(value, i++);
}
return m;
}
Insert cell
Insert cell
anArrayFromMap = ƒanArrayFromMap()
Insert cell
ƒanArrayFromMap = () => Array.from(aMap.values())
Insert cell
Insert cell
anObjectLiteral = ƒanObjectLiteral()
Insert cell
ƒanObjectLiteral = () => ({
seenAs: "object",
by: "getNotebook",
isHandled: "properly"
})
Insert cell
Insert cell
anArray = ƒanArray()
Insert cell
ƒanArray = () => [0, 1, 2, 3]
Insert cell
Insert cell
anotherObject = ƒanotherObject()
Insert cell
ƒanotherObject = () => {
let anotherObject = {};
Object.assign(anotherObject, anObjectLiteral);
anotherObject.isHandled = "also properly";
return { anotherObject, anObjectLiteral };
}
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