Team Stats .... .push()

Hi! I am working on the Team Stats (

On line 51 and 60, the .push() method is giving me problems.

What am I doing incorrectly?

const team = {
  _players: [
      firstName: 'Dan',
      lastName: 'Boyd',
      age: 48
      firstName: 'Rob',
      lastName: 'Sanchez',
      age: 45
      firstName: 'Toby',
      lastName: 'Largust',
      age: 41
  _games: [
      opponent: 'Broncos',
      teamPoints: 42,
      opponentPoints: 27
      opponent: 'Lightnings',
      teamPoints: 40,
      opponentPoints: 18
      opponent: 'Ravens',
      teamPoints: 82,
      opponentPoints: 40

  get _players() {
    return this._players;
  get _games() {
    return this._games;

  addPlayer(firstName, lastName, age) {
  let player = {
  firstName: firstName,
    lastName: lastName,
    age: age

addGame(opponent, teamPoints, opponentPoints) {
    let game = {
      opponent: opponent,
      teamPoints: teamPoints,
      opponentPoints: opponentPoints

team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Bugs', 'Bunny', 76);
team.addGame('Titans', 100, 98);

The issue is actually your getter methods. In your functions you are using this.players and which I presume is meant to work off of the getters. However your getters have the names _players and _games, therefore this.players and returns undefined as they do not exist. You need to remove the underscore from your getter definitions and everything should work right.

1 Like

Thanks for your response, I tried using just “this.players” and “”, however I still receive the same error message.


TypeError: Cannot read property 'push' of undefined

Sorry I should have been clearer, it’s the getter definitions here

That are the issue. When you’re referring to this.players, it’s not finding anything as these have an underscore in front of them.

1 Like