Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 16, 2020 00:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/4687bb68413c7925434abd8b00b77d59 to your computer and use it in GitHub Desktop.
Save codecademydev/4687bb68413c7925434abd8b00b77d59 to your computer and use it in GitHub Desktop.
Codecademy export
const team = {
_players: [
{firstName: 'Pablo', lastName: 'Sanchez', age: 19
},
{firstName: 'John', lastName: 'Smith', age: 20
},
{firstName: 'Chris', lastName: 'Devita', age: 22
},
],
_games: [
{opponent: 'Broncos', teamPoints: 42, opponentPoints: 27
},
{opponent: 'Wolvess', teamPoints: 23, opponentPoints: 35
},
{opponent: 'Lions', teamPoints: 15, opponentPoints: 20
}
],
get players() {
this._players;
},
get games() {
return this._games;
},
addPlayer(firstName, lastName, age) {
let player = {
firstName: firstName,
lastName: lastName,
age: age
};
this.players.push(player);
}
};
team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
console.log(team.players);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment