Public
Edited
Nov 17, 2022
Insert cell
Insert cell
arr = [2, 4, 5]
Insert cell
arr.map((item, i) => arr[i])
Insert cell
arr.map(function (item, i) {
return arr[i];
})
Insert cell
function addTwo(number) {
return number + 2;
}
Insert cell
arr.map(addTwo)
Insert cell
function pythagorean(a, b) {
return Math.sqrt(a ** 2 + b ** 2);
}
Insert cell
pythagorean(3, 2)
Insert cell
Insert cell
points[1].geometry.coordinates[0]
Insert cell
x_distance = {
const x_coords = points.map((i) => i.geometry.coordinates[0]);
return x_coords[0] - x_coords[1];
}
Insert cell
y_distance = {
const y_coords = points.map((i) => i.geometry.coordinates[1]);
return y_coords[0] - y_coords[1];
}
Insert cell
pythagorean(x_distance, y_distance)
Insert cell
names = FileAttachment("Untitled spreadsheet - Sheet1(1).csv").csv()
Insert cell
function getFirstName(fullName) {
return fullName.split(" ")[0];
}
Insert cell
firstNames = names.map(function (item) {
return getFirstName(item.name);
})
Insert cell
function lessThan5(firstName) {
return firstName.length < 5;
}
Insert cell
firstNames.filter((item) => lessThan5(item))
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