I have just finished the lesson on Objects and i’m dealing with the 2 mini projects:
- Meal Maker
- Team Stats
In those 2 projects, we are asked to add getter methods that return the property itself and that’s it.
What is the objective of this?
I mean: for the Team Stats project for example, we obtain the exact same result without the get methods if in the 2 fuctions addPlayer and addGame we call: this._players.push(player) instead of this.players.push(player) and this._games.push(game) instead of this.game.push(game).
Can someone explain to me the purpose of the get method for that Team Stat project?