Public
Edited
Mar 11
Insert cell
Insert cell
// This is a simple variable assignment using "="
a = 1
Insert cell
// assigning another variables
b = 1
Insert cell
// simple arithmetic can be assigned to variable and that formula can include other variables
c = a + b
Insert cell
// the "=>" (arrow function) creates a function
// here, I am defining the arguments as "a" and "b"
// then, defining the function as "a+b"
d = (a,b) => a + b
Insert cell
// when I call the function "d" and insert two arguments, it runs the function on those arguments
d(3,4)
Insert cell
// Because the function only has two arguments, even if I specify more than two it will only use the first two in the calculation
d(3,4,5)
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