Public
Edited
Dec 17, 2023
Insert cell
Insert cell
// to execute, click the run button or hit ctrl + enter
{
const birth_year = 1850;
return birth_year;
}
Insert cell
// The built-in show() helper function can be used to display values in the preview window on the right

{
const birth_year2 = 1900;
return birth_year2;
}
Insert cell
function getDirection(birth_year, birth_year2) {
if (birth_year2 - birth_year > 0) {
return "W";
} else {
return "E";
}
}
Insert cell
getDirection(1900, 1850)
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