Skip to content

Instantly share code, notes, and snippets.

@medxpy
Forked from codecademydev/app.js
Created May 2, 2020 18:56
Show Gist options
  • Save medxpy/56a8cf794f76f24f645af65c2d174997 to your computer and use it in GitHub Desktop.
Save medxpy/56a8cf794f76f24f645af65c2d174997 to your computer and use it in GitHub Desktop.
Codecademy export
const team = {
_players: [
{
firstName: 'Luka',
lastName: 'Dune',
age: 13,
}
],
_games: [
{
opponent: 'Tennis',
teamPoints: 33,
opponentPoints: 16,
}
],
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);
},
addGame(opp, myPts, oppPts) {
let game = {
opponent: opp,
teamPoints: myPts,
opponentPoint: oppPts,
};
this.games.push(game);
}
};
team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
team.addGame('Golf', 43, 13);
team.addGame('koora', 20, 16);
team.addGame('hockey', 15, 20);
console.log(team.players)
console.log(team.games)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment