Team stats

Hey,

I am stuck with the Team Stats project (https://www.codecademy.com/courses/introduction-to-javascript/projects/team-stats).

I get an error message saying that “team._players.push” is not a function. I have tried using this._players.push, inserting a getter for it.
I went though the walkthrough video and still cannot fund the bug.

Any help please?
Thanks!

const team = {
    _players: {
        firstName: [],
        lastName: [],
        age: []
    },

    addPlayer(firstName, lastName, age) {
        let player = {
            firstName: firstName,
            lastName: lastName,
            age: age
        };
        console.log(this._players);
        console.log(player);
        team._players.push(player);
    }
}

team.addPlayer('Tata', 'YoYo', 18);

team._players (or this._players is a dictionary. .push() is an array specific method.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.