-
-
Save codecademydev/82443896d689b0f20a3b1a3268a3f99d to your computer and use it in GitHub Desktop.
Codecademy export
This file contains 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
const team = { | |
_players: [ | |
{ | |
firstName: 'Luka', | |
lastName: 'Dune', | |
age: 13, | |
} | |
], | |
_games: [ | |
{ | |
opponent: 'Tennis', | |
teamPoints: 33, | |
opponentPoints: 16, | |
} | |
], | |
get players(){ | |
return this._players; | |
}, | |
get games(){ | |
return this._games; | |
}, | |
addPlayer(firstName, lastName, age){ | |
let player = { | |
firstName: firstName, | |
lastName: lastName, | |
age: age, | |
}; | |
this.players.push(player); | |
}, | |
addGame(opp, myPts, oppPts) { | |
let game = { | |
opponent: opp, | |
teamPoints: myPts, | |
opponentPoint: oppPts, | |
}; | |
this.games.push(game); | |
} | |
}; | |
team.addPlayer('Steph', 'Curry', 28); | |
team.addPlayer('Lisa', 'Leslie', 44); | |
team.addPlayer('Bugs', 'Bunny', 76); | |
team.addGame('Golf', 43, 13); | |
team.addGame('koora', 20, 16); | |
team.addGame('hockey', 15, 20); | |
console.log(team.players) | |
console.log(team.games) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment