const team = {
_players: [
{firstName: 'Steve',
lastName: 'Johnson',
age: 28},
{firstName: 'Tony',
lastName: 'Cantalope',
age: 26},
{firstName: 'Isaac',
lastName: 'Thomas',
age: 22}
],
_games: [
{opponent: 'Texas', teamPoints: 99, opponentPoints: 78},
{opponent: 'Indiana', teamPoints: 123, opponentPoints: 101},
{opponent: 'Wisconsin', teamPoints: 91, opponentPoints: 90},
],
get players() {
return this._players;
},
get games() {
return this._games;
},
addPlayer(newFirstName, newLastName, newAge) {
this._players.push({firstName: newFirstName, lastName: newLastName, age: newAge});
},
addGame(newOpponent, newTeamPoints, newOpponentPoints) {
this._games.push({opponent: newOpponent, teamPoints: newTeamPoints, opponentPoints: newOpponentPoints})
}
}
team.addPlayer('Bugs', 'Bunny', 76);
console.log(team.players);
team.addGame('Titans', 100, 98);
console.log(team.games);