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

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