Hello everyone, I am not sure why the .push() method is giving me an error, this also happened on the Meal Maker project. When I tried to print out (task 7) it gave me a type error for the .push() method. Is it a syntax error?
const team = {
_players: [
{
firstName: 'Beyonce',
lastName: 'Knowles',
age: 39,
},
{
firstName: 'Rihanna',
lastName: 'Fenty',
age: 33,
},
{
firstName: 'Solana',
lastName: 'Rowe',
age: 30,
}
],
_games: [
{
opponent: 'Redskins',
teamPoints: 50,
opponentPoints: 27,
},
{
opponent: 'Hornets',
teamPoints: 42,
opponentPoints: 32,
},
{
opponent: 'Mavericks',
teamPoints: 65,
opponentPoints: 42,
}
],
get player() {
return this._players;
},
get games() {
return this._games;
},
addPlayer(firstName, lastName, age) {
let player = {
firstName: firstName,
lastName: lastName,
age: age
}
this.players.push(player)
},
};
team.addPlayer(‘Steph’, ‘Curry’, 28);