Public
Edited
Feb 23, 2023
Fork of PSET 2
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const myArray = ["Hello", "my", "name", "is"]
let arrayLength = myArray.length
return arrayLength
}
Insert cell
array1=['I', 'am', 'learning','Javascript','to','munge','large','datasets','and','visualize','them']
Insert cell
Insert cell
Insert cell
Insert cell
// Make an object with array of places (each place has loc, name, lat, long), and a method to return that array.
topPlaces = ({
places: [{ // an array named places, with 5 objects
location: "NY",
name: "New York",
latlon: [42,72]
},
{
location: "SF",
name: "San Francisco",
latlon: [55, 34]
},
{
location: "BS",
name: "Boston",
latlon: [42, 64]
}
],
getTops: function () {
return [this.places[0].name.toUpperCase(), this.places[1].name.toUpperCase()]
},
getLow: function () {
return this.places[this.places.length - 1].name.toUpperCase()}
})


Insert cell
Insert cell
topPlaces.getLow = function () {
return this.places[-1].name.toUpperCase()
}

Insert cell
topPlaces.places.push({
location: "NY",
name: "New York",
latlon: [42,72]
})
Insert cell
topPlaces.getLow()
Insert cell
topPlaces.getTops()
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