When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
Link to the exercise: Learn JavaScript | Codecademy
Error Message:
/home/ccuser/workspace/learn-javascript-objects-team-stats-revised/app.js:2
_players : [{firstName: ‘Dak’, lastName: ‘Prescott’, age: 29}, {firstName: ‘Ezekiel’, lastName: ‘Elliott’, 27}, {firstName: ‘CeeDee’, lastName: ‘Lamb’, 23}],
^
SyntaxError: Unexpected token ‘}’
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions…js
const team = {
_players : [{firstName: 'Dak', lastName: 'Prescott', age: 29}, {firstName: 'Ezekiel', lastName: 'Elliott', 27}, {firstName: 'CeeDee', lastName: 'Lamb', 23}],
_games : {opponent: 'Washington', teamPoints: 6, opponentPoints: 26} {opponent: "Tennessee", teamPoints: 27, opponentPoints: 13} {opponent: 'Philadelphia', teamPoints: 40, opponentPoints: 34}
};
get players(){
return this._players
}
Firstly, where did I go wrong? I thought my syntax was fine.
Secondly I have a question about task 5
per the instructions: Create a getter method called players
to retrieve the _players
property. Inside the getter method, return
the _players
property.
For the scope of this project, we won’t need to create setter methods, because we don’t want anyone to change the data saved to the properties.
my question: what are looking to do with this get method? Grab the properties of what? The first name and last name and age?