Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 16, 2020 16:28
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/ce16af4e25b164f292c97cd8f3bdd38f to your computer and use it in GitHub Desktop.
Save codecademydev/ce16af4e25b164f292c97cd8f3bdd38f to your computer and use it in GitHub Desktop.
Codecademy export
const team = {
_players: [
{ firstName: "Tomas",
lastName: "Paulauskas",
age: 32 },
{ firstName: "Simas",
lastName: "Ivanauskas",
age: 22 },
{ firstName: "Rokas",
lastName: "Malinauskas",
age: 28 },
],
_games:[
{opponent: "Kates",
teamPoints: 32,
opponentPoints: 28},
{opponent: "Banga",
teamPoints: 52,
opponentPoints: 21},
{opponent: "Vetra",
teamPoints: 13,
opponentPoints: 56},
],
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);
}
}
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