Team Stats projects

Im having issues with the Team Stats project. I feel like I have tried everything to fix the error but to no avail. Thank you for your help in advanced.
This is the error I am getting:
get _players () {
SyntaxError: Unexpected identifier

and here is my code:

const team = {
_players: [
{firstName: “Jane”, lastName: “David”, age: 28},
{firstName: “Bob”, lastName: “John”, age: 5},
{firstName: “Smith”, lastName: “Joe”, age: 27}
_games: [
{opponent: “Broncos”, teamPoints: 42, opponentPoints: 27},
{opponent: “Wolves”, teamPoints: 26, opponentPoints: 41},
{opponent: “Lions”, teamPoints: 92,opponentpoint: 62}
get players() {
return this._players;
get games() {
return this._games;
addPlayer(firstName, lastName, age) {
let players = {
firstName: firstName,
lastName: lastName,
age: age
team.addPlayer (“Lisa”, “Leslie”, 28)
team.addPlayer(“Steph”, “Curry” 27);
team.addPlayer(“Bugs”, “Bunny”, 76);

Hi @hayleyhanna403221932
Welcome to the forum!

from what I see the line of code the error message is complaining about isn’t in your code anymore. Did you post a corrected version?
I still see syntax errors though. The getters are out of scope and there is at least one spot where you’re mixing commas and semicolons.

Hello hayleyhanna,
i see that you having Scope errors in your code , your puting variables inside block scope and trying to invoke them in global. i think that might be causing an issue for you.

Hi there!
Your problem can be found here:

As mentioned by another user, you are using the this keyword outside of your object, also known as the global scope. If you have not yet gotten a good understand of the this keyword, it is a reference keyword which is used to refer to the object from which you’re calling the keyword inside.

const myObject = {
  _players: ['Jonathan', 'Mike'],
  get players() { return this._players } // this refers to the 'myObject' object.

The global scope obviously does not have a players nor games property, and therefore both getter functions and all methods whom belong to the team object should be called from inside the same object.

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