Public
Edited
Jan 31, 2023
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
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
new Set(words).size
Insert cell
Insert cell
prices = ({
milk: 3.45,
crackers: 4.54,
pepsi: 1.00,
chips: 2.98,
})
Insert cell
prices.milk
Insert cell
Insert cell
food = "chips"
Insert cell
prices.chips
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, ([items,cost]) => ({items,cost}))
Insert cell
Insert cell
function triangleArea(base, height) {
return base * height / 2;
}
Insert cell
triangleArea(10, 20)
Insert cell
// answer
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