-
-
Save codecademydev/ecfb8b11ab095604d8de3d599357af79 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: 'Ginny', lastName: 'Potter', age: 15}, | |
{firstName: 'Harry', lastName: 'Potter', age: 17}, | |
{firstName: 'Hermione', lastName:'Griffin', age: 17} | |
], | |
_games: [ | |
{opponent: 'Zwadderich', teamPoints: 400, opponentPoints: 0}, | |
{opponent: 'Hufflepuf', teamPoints: 2, opponentPoints: 300}, | |
{opponent: 'Griffioendor', teamPoints: 500, opponentPoints: 2} | |
], | |
getgames() { | |
return this._games; | |
}, | |
getplayers() { | |
return this._players; | |
}, | |
addPlayer(firstName, lastName, age) { | |
let player = { | |
firstName: firstName, | |
lastName: lastName, | |
age: age | |
}; | |
this.players.push(player); | |
}, | |
}; | |
team.addPlayer('Steph', 'Curry', 28); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment