Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created August 26, 2021 17:08
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/3bfa88252b608d2306d0400382335536 to your computer and use it in GitHub Desktop.
Save codecademydev/3bfa88252b608d2306d0400382335536 to your computer and use it in GitHub Desktop.
Codecademy export
const team = {
_players: [
{
firstName: 'Beyonce',
lastName: 'Knowles',
age: 39,
},
{
firstName: 'Rihanna',
lastName: 'Fenty',
age: 33,
},
{
firstName: 'Solana',
lastName: 'Rowe',
age: 30,
}
],
_games: [
{
opponent: 'Redskins',
teamPoints: 50,
opponentPoints: 27,
},
{
opponent: 'Hornets',
teamPoints: 42,
opponentPoints: 32,
},
{
opponent: 'Mavericks',
teamPoints: 65,
opponentPoints: 42,
}
],
get player() {
return 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment