JavaScript Syntax, Part II > Learn JavaScript Syntax: Objects > 'Team Stats'

Hello! :smiley:
I just finished the Team Stats project. Just wanted to share my codes, and if someone has some suggestions please comment! Thanks.

const team = {
  _players: [
    {
      firstName: 'Moana',
      lastName: 'Altoviti',
      age: 25
    },
    {
      firstName: 'Rajani',
      lastName: 'Klein',
      age: 29
    },
    {
      firstName: 'Jody',
      lastName: 'Arthur',
      age: 28
    }
  ],
  _games: [
    {
      opponent: 'Slytherin',
      teamPoints: 5,
      opponentPoints: 5
    },
    {
      opponent: 'Ravenclaw',
      teamPoints: 7,
      opponentPoints: 3
    },
    {
      opponent: 'Gryffindor',
      teamPoints: 8,
      opponentPoints: 5
    }
  ],
  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, newTeamPoints, newOpponentPoints) {
    let game = {
      opponent: newOpponent,
      teamPoints: newTeamPoints,
      opponentPoints: newOpponentPoints
    };
    this.games.push(game);
  }
};

team.addPlayer('Bugs', 'Bunny', 34);
team.addGame('Titans', 100, 98);

// Additional projects: 
// total number of games my team has played
// average score of all of their games

let names = [];
for (let listOfNames in team._players) {
  let playerNames = team._players[listOfNames].firstName; 
  names.push(playerNames);
}

for (let i = 0; i < names.length; i++) {
  let playerInfo = Object.create(team._players[i]);
  console.log(`Introducing player: ${playerInfo.firstName}, ${playerInfo.age}`);
};

let scores = [[], []];
for (let game in team._games) {
  let plus = team._games[game].teamPoints;
  scores[0].push(plus);
  let minus = team._games[game].opponentPoints;
  scores[1].push(minus);
}

const scoreWin = scores[0].reduce((a, b) => a + b);
const timesOfPlay = scores[0].length;
const aveScore = scoreWin/timesOfPlay;

console.log(`Our team has played ${timesOfPlay} games in total. Has scored ${aveScore} points on average.`);

This is the result logged:

Introducing player: Moana, 25
Introducing player: Rajani, 29
Introducing player: Jody, 28
Introducing player: Bugs, 34
Our team has played 4 games in total. Has scored 30 points on average.