Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 18, 2019 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/ecfb8b11ab095604d8de3d599357af79 to your computer and use it in GitHub Desktop.
Save codecademydev/ecfb8b11ab095604d8de3d599357af79 to your computer and use it in GitHub Desktop.
Codecademy export
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