Public
Edited
Jan 22, 2024
Insert cell
Insert cell
Insert cell
65+65
Insert cell
Insert cell
Insert cell
console.log("Hello world")
Insert cell
helloMit = "Hello MIT"
Insert cell
console.log(helloMit)
Insert cell
Insert cell

/*
this is a multiline comment
many lines of comments

*/

Insert cell
Insert cell
Insert cell
height = 500
Insert cell
Insert cell
{
let height = 800
height = 1000
return height
}
Insert cell
Insert cell
dimension = ({height, width})
Insert cell
width = 480
Insert cell
Insert cell
// dimension = {1000, 960}
Insert cell
Insert cell
{
let firstNumber = 55
return firstNumber + 10
}
Insert cell
// This block defines a cumulative sum of numbers from 0 to 10
{
let x = 0;
for (let i = 1; i <= 10; ++i) {
x += i;
}
return x;
}
Insert cell
Insert cell
x
Insert cell
Insert cell
function running_total(max) {
let x = 0;
for (let i = 1; i <= max; ++i)
x += i;
return x;
}
Insert cell
function addingNumbers(number3, number4){
let number5 = number3 + number4
return number5
}
Insert cell
addingNumbers(5,'this')
Insert cell
running_total(10)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const a = 5;
a = 6;
return a;
}
Insert cell
Insert cell
Insert cell
{
let a = 5;
a = 6
return a + 30
}
Insert cell
Insert cell
Insert cell
1 + 2
Insert cell
typeof (1 + 2)
Insert cell
Insert cell
1.0 + 2.5
Insert cell
typeof (1.0 + 2.5)
Insert cell
2 / 0
Insert cell
typeof (2 / 0)
Insert cell
"a" / 2
Insert cell
typeof ("a" / 2)
Insert cell
Insert cell
"hello, world"
Insert cell
typeof "hello, world"
Insert cell
"hello, " + "world"
Insert cell
name = "" // Fill your name in here!
Insert cell
`hello, world, it's ${name}`
Insert cell
typeof (`hello, world, it's ${name}`)
Insert cell
`today is ${day}`
Insert cell
Insert cell
Insert cell
9 > 10
Insert cell
typeof (9 > 10)
Insert cell
10 == 10
Insert cell
Insert cell
(9 < 10) && (10 == 10) // Evaluates to false AND true
Insert cell
(9 > 10) || (10 == 10) // Evaluates to false OR true
Insert cell
!(9 > 10) && (10 == 10) // Evaluates to NOT(false) AND true
Insert cell
!((9 > 10) || (10 == 10)) // Evaluates to NOT(false or true)
Insert cell
Insert cell
Insert cell
typeof (x)
Insert cell
Insert cell
Insert cell
{ let y
return typeof (y)
}
Insert cell
Insert cell
ra = ["one", 2, 3.0]
Insert cell
ra[2]
Insert cell
typeof ra
Insert cell
ra[0]
Insert cell
ra[3]
Insert cell
Insert cell
function addthese(a, b) {
return a+b;
}
Insert cell
typeof(addthese)
Insert cell
typeof(addthese(1, 4))
Insert cell
Insert cell
Insert cell
margin = ({top : 500,
bottom : 300})
Insert cell
car = ({
make: 'Fiat',
model: 500,
})
Insert cell
{
car.model
return [car.make, car.model]
}
Insert cell
Insert cell
Insert cell
"hello, world".toUpperCase()
Insert cell
Insert cell
directory = {
const data = {"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]};
return data
}
Insert cell
directory.employees
Insert cell
directory.employees[1]
Insert cell
directory.employees[1].firstName
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more