so Im doing the team stats project and my code keeps missing off the first 2 players and the first 2 games when i print to console can someone explain why. Here is my code:
const team = {
_players: [
{
firstName: 'Owen',
lastName: 'Farrel',
age: 32,
firstName: 'Jonny',
lastName: 'May',
age: 30,
firstName: 'Tom',
lastName: 'Curry',
age: 25
},
],
_games: [
{
opponent: 'France',
teamPoints: 24,
opponentPoints: 20,
opponent: 'Italy',
teamPoints: 42,
opponentPoints: 14,
opponent: 'Wales',
teamPoints: 18,
opponentPoints: 21,
},
],
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(oppName, teamPnts, oppPnts){
let game = {
opponent: oppName,
teamPoints: teamPnts,
opponentPoints: oppPnts
};
this.games.push(game);
},
};
team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
team.addGame('South Africa', 17, 24);
team.addGame('New Zealand', 32, 18);
team.addGame('Japan', 28, 7);
console.log(team.players);
console.log(team.games);