-
-
Save codecademydev/a5d4e3279b506abc1fe5b0cc677a31e5 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const team = { | |
_players :[ | |
{firstName:'samir',lastName:'awad',age:34}, | |
{firstName:'shrief',lastName:'awad',age:33}, | |
{firstName:'loubna',lastName:'awad',age:37} | |
], | |
_games :[ | |
{opponent:'paul',teamPoints:2,opponentPoints:2}, | |
{opponent:'rayan',teamPoints:2,opponentPoints:2}, | |
{opponent:'jack',teamPoints:2,opponentPoints:2} | |
], | |
get players(){ | |
return this._players; | |
}, | |
get games(){ | |
return this._games; | |
}, | |
addPlayer(newFirstName,newLastName,newAge){ | |
let player = { | |
firstName:newFirstName, | |
lastName:newLastName, | |
age:newAge | |
}; | |
this._players.push(player) | |
}, | |
addGame(newOpponent,newTeamPoint,newOpponentPoints){ | |
let game = { | |
opponent:newOpponent, | |
teamPoint:newTeamPoint, | |
opponentPoints:newOpponentPoints | |
} | |
this._games.push(game) | |
} | |
}; | |
team.addGame('Titans',100,98) | |
console.log(team.games); | |
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