Need someone to check my code on the project "Team Stats"

Is there something I could do better or improve readability?

My code for “Team Stats” project

My only feedback based on the lesson you were on for this project is to remember to use your getters

console.log(team._players);
console.log(team._games);

You set up the getters players and games to avoid having to directly access the “_” properties of the object that are acting as private properties of the object.

Other than that, your code is looking good - the variables are descriptive too.

Looks good :slight_smile: Just a suggestion - as per this lesson, you could use property value shorthand to avoid repeating yourself in creating a new object.

So this:

addPlayer(firstName, lastName, age) {
    let newPlayer = {
      firstName: firstName,
      lastName: lastName,
      age: age,
    };
    this._players.push(newPlayer);
  }

could become this:

addPlayer(firstName, lastName, age) {
    let newPlayer = {
      firstName,
      lastName,
      age
    };
    this._players.push(newPlayer);
  },

and similarly for addGame.