addGame (opponent, teamPoints, opponentPoint) {
let game = {
opponent: oppenent,
taemPoints: teamPoints,
oppenentPoints: opppenentPoints
},
this.games.push(game);
}
Here is the error message:
/home/ccuser/workspace/learn-javascript-objects-team-stats/app.js:59
this.games.push(game);
^^^^
SyntaxError: Unexpected token this
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
Thanks looks like I forgot to close the player object in the method as well, but now I am getting a different error.
addPlayer (firstName, lastName, age) {
let player = {
firstName: firstName,
lastName: lastName,
age: age
};
this.players.push(player);
},
/home/ccuser/workspace/learn-javascript-objects-team-stats/app.js:26
this.players.push(player);
^
TypeError: Cannot read property 'push' of undefined
at Object.addPlayer (/home/ccuser/workspace/learn-javascript-objects-team-stats/app.js:26:19)
at Object.<anonymous> (/home/ccuser/workspace/learn-javascript-objects-team-stats/app.js:39:6)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
Again, check your blocking. this is the team object, if I recall. Your method needs to be inside that enclosure. Be sure your getter is properly scoped, as well.