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 20 schools and n."
//answer
paragraph.length
// answer
words=paragraph.split(' ')
// answer
words.length
// answer
words[1]
// answer
newSet(words).size
prices=({
milk:3.45,
crackers:4.54,
pepsi:1.00,
chips:2.98,
})
// answer
prices.milk
prices["milk"]
food="chips"
// answer
prices[food]
[
["milk",3.45],
["crackers",4.54],
["pepsi",1.00],
["chips",2.98]
]
kvps=Object.entries(prices)
Object.fromEntries(kvps)
// answer
items=newMap(kvps)
// answer
items.get("milk")
snack="chips"
// answer
items.get(snack)
// answer
Array.from(items.keys())
[...items.keys()]
// answer
Array.from(items)
// answer
Array.from(items,([items,cost])=>({items,cost}))
Array.from(items,function(pair){
return{
item:pair[0],
cost:pair[1]
}
})
functiontriangleArea(base,height){
returnbase*height/2;
}
triangleArea(10,20)
// answer
triangleAreaArrow=(base,height)=>base*height/2
triangleAreaArrow(10,20)
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.