Published
Edited
Sep 9, 2021
Insert cell
Insert cell
Insert cell
paragraph = 'Since its founding in 1831, NYU has been an innovator in higher education, reaching out to an emerging middle class, embracing an urban identity and professional focus, and promoting a global vision that informs its 19 schools and colleges.'
Insert cell
about_page_length = paragraph.length
Insert cell
Insert cell
words = paragraph.split(' ')
Insert cell
Insert cell
words.length
Insert cell
Insert cell
words[1]
Insert cell
Insert cell
unique_words = new Set(words).size
Insert cell
Insert cell
prices = ({
milk: 3.45,
crackers: 4.54,
pepsi: 1.00,
chips: 2.98,
})
Insert cell
milk_price = prices.milk
Insert cell
Insert cell
food = "chips"
Insert cell
chips_price = prices[food]
Insert cell
Insert cell
[
["milk", 3.45],
["crackers", 4.54],
["pepsi", 1.00],
["chips", 2.98]
]
Insert cell
kvps = Object.entries(prices);
Insert cell
Insert cell
Object.fromEntries(kvps)
Insert cell
Insert cell
items = new Map(kvps)
Insert cell
Insert cell
items.get('milk')
Insert cell
Insert cell
snack = "chips"
Insert cell
items.get(snack)
Insert cell
Insert cell
Array.from(items.keys())
Insert cell
Insert cell
Array.from(items)
Insert cell
Insert cell
Array.from(items, function(params) {
return {
item : params[0],
cost : params[1]
};
})
Insert cell
Array.from(items, ([item, cost]) => ({ item, cost}));
Insert cell
Insert cell
function triangleArea(base, height) {
return base * height / 2;
}
Insert cell
triangleArea(10, 20)
Insert cell
triangleAreaArrowFunction = (base, height) => base * height / 2
Insert cell
triangleAreaArrowFunction(50,10)
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