Created
March 15, 2020 21:59
-
-
Save jdaly13/6973d7ccd20ebd81751086739ff7f926 to your computer and use it in GitHub Desktop.
classes javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFavoriteThingsEachCity (sport, landmark, food) { | |
const object = {}; | |
object[this.constructor.name]= { | |
team: this.sportsTeams[sport], | |
landMarks: this.landmarks[landmark], | |
food: this.bestFoods[food] | |
} | |
return object | |
} | |
class StLouis { | |
constructor(areaCode) { | |
this.areaCode = areaCode; | |
this.sportsTeams = ["blues", "cardinals", "battlehawks"]; | |
this.landmarks = ["The Gateway Arch", "City Musuem"]; | |
this.bestFoods =["bbq", "sandwerches", "italian"] | |
} | |
favoriteSportsTeam(index) { | |
return this.sportsTeams[index]; | |
} | |
favoriteThings(sport, landmark, food) { | |
// return myFavoriteThingsEachCity.call(this, sport, landmark, food) | |
} | |
} | |
const stLouis = new StLouis(314); | |
const favoriteTeam = stLouis.favoriteSportsTeam(2); | |
//console.log(stLouis.favoriteThings(2,0,0)) | |
console.log(myFavoriteThingsEachCity.call(stLouis, 2, 0, 0)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment