Game Stats project - theoretical question about getter

Link to the project
I pasted the code below.
My question is about this.players.push(player) code line.
I originally wrote it with _players
But the hints suggested players
the players is a getter - and getters only retrieve values of a property.
How come this.players.push(player) is able to modify the _player property?
My understanding was - only setters can change(set) properties of an object.

const team = {
    _players: [{
        firstName: 'Juan',
        lastName: 'DelaShmate',
        age: 20,
        firstName: 'Carlos',
        lastName: 'Muchacho',
        age: 23,
        firstName: 'Mipham',
        lastName: 'Gungtang',
        age: 18,
    _games: [
            opponnent: 'Macabbi',
            teamPoints: 30,
            opponnent: 'Liverpoodlican',
            teamPoints: 40,
            opponentPoints: 46,
            opponnent: 'FC New Delhi',
            teamPoints: 40,
            opponentPoints: 41,
    get games(){
        return this._games;
    get players(){
        return this._players;
    // step 6
    addPlayer(firstName, lastName, age){
        let player = {
            firstName: firstName,
            lastName: lastName,
            age: age,
        this.players.push(player)  // ALTERNATIV CODE
    addGame(opponent, teamPoints, opponentPoints){
        let game = {
            opponent: opponent,
            teamPoints: teamPoints,
            opponentPoints: opponentPoints,

team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
team.addGame('Mechlen FC', 50, 29);
team.addGame('Nairoby Rangers', 40, 32);
team.addGame('Tokyo SanYo', 33, 22);
team.addGame('Berlin FC', 40, 42);

Let’s break down what this line does: this.players.push(player)

  • this.players calls the getter to this particular object instance. For example, if you heave team NYKnicks, it would only call the players method of the NYKnicks (and not some other team).
  • the players method then returns _players object. It doesn’t change _players.
  • Now we have _players object, to which we push player. This is the mutator behavior that the setter is actually doing.

The takeaway is that just because we have multiple things happening in one line, doesn’t mean any of the roles are violated. I think it’s fairly ok to use a getter within a setter method if it helps (someone correct me on this if I’m off).

Also in terms of access, this is not like C++ where we have private and protected data members. The leading underscore _ is simply a convention to alert the programmer as to the intended privacy of a variable. It is not enforced by the interpreter when running the script.

I’m not aware of what the current convention for privacy in javascript (not my main language) is but it may be worth some time reading in to. Here are some things I glanced at:

thank you @toastedpitabread
I appreciate the answer.
btw - toasted pita bread is a favorite childhood dish - especially with melted cheese in it. yam