Public
Edited
Apr 10
1 fork
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
1 + 2 // Clearly sum of two numbers
Insert cell
"A" + "B" // Clearly combination of two strings
Insert cell
1 + "2" // Join a number and a piece of text?
Insert cell
Insert cell
Insert cell
Insert cell
function get_miles_driven () {
return 200
}
Insert cell
get_miles_driven()
Insert cell
Insert cell
get_miles_driven() > 0
Insert cell
Insert cell
Insert cell
get_miles_driven() > 0 ? "Car is used" : "Car is new"
Insert cell
get_miles_driven() ? "Car is used" : "Car is new"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
is_alive
Insert cell
is_alive ? "green" : "red"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
is_healthy
Insert cell
is_old
Insert cell
is_healthy && is_old // and
Insert cell
is_healthy || is_old // or
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
napoleon_birth_year = 1769
Insert cell
current_year = new Date().getFullYear()
Insert cell
Insert cell
current_year - napoleon_birth_year
Insert cell
Insert cell
Insert cell
Insert cell
(current_year - napoleon_birth_year) / 1000
Insert cell
Insert cell
Insert cell
tax_rate = 0.24
Insert cell
price = 17.99
Insert cell
tax_free_price = price / (1 + tax_rate)
Insert cell
Insert cell
Insert cell
Insert cell
interest_rate = 0.0288
Insert cell
daily_interest_rate = interest_rate / 365
Insert cell
daily_interest = capital * daily_interest_rate
Insert cell
capital + daily_interest
Insert cell
Insert cell
Insert cell
Date.now()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
[r, g, b]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
first_name = "Napoleon"
Insert cell
last_name = "Bonaparte"
Insert cell
full_name = first_name + " " + last_name
Insert cell
Insert cell
Insert cell
full_name.length
Insert cell
Insert cell
full_name.indexOf("B")
Insert cell
Insert cell
full_name.replaceAll("a", "Σ")
Insert cell
Insert cell
full_name.toUpperCase()
Insert cell
Insert cell
Insert cell
"https://aliveordead.com/" + full_name.toLowerCase().replaceAll(" ", "-")
Insert cell
Insert cell
Insert cell
Insert cell
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Insert cell
letters = ["a", "b", "c", "d", "e", "f"]
Insert cell
Insert cell
Insert cell
numbers.length
Insert cell
letters.length
Insert cell
Insert cell
Insert cell
letters[1]
Insert cell
Insert cell
Insert cell
Insert cell
[...numbers, ...letters]
Insert cell
Insert cell
Insert cell
_.reverse([...numbers])
Insert cell
Insert cell
Insert cell
Insert cell
_.slice(letters, 0, 2) // Picks 2 values, starting from the 0th position
Insert cell
_.slice(letters, letters.length / 2) // Get latter half of the list
Insert cell
Insert cell
Insert cell
function number_filter_condition (number) {
return number < 5
}
Insert cell
_.filter(numbers, number_filter_condition)
Insert cell
Insert cell
Insert cell
numbers_plus_ten = _.map(numbers, (num) => num + 10)
Insert cell
Insert cell
Insert cell
_.sum(numbers)
Insert cell
_.sum(numbers_plus_ten)
Insert cell
Insert cell
Insert cell
letters.join(" and ")
Insert cell
Insert cell
Insert cell
[numbers, numbers_plus_ten]
Insert cell
Insert cell
_.map([numbers, numbers_plus_ten], _.sum)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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