How to reference a class object? javascript : Assume the following class:

    class Player{
     constructor(id,name){
      this.id=id;
      this.name=name;
     }
    }

If I would like to instantiate the class I would go about `var player = new Player(1,'Mike')` and then I could access the values with dot notation such as `player.name`. I'm trying to use an iteration to generate several players and add them into an array and part of the code is:

    let player =[];
    player.push( playerName = new Player(id,playerName);
If insert a var infront of playerName i.e. `player.push( playerName = new Player(id,playerName);` it throws an error. Currently the only way to access the name would be `player[0].name` which is not convenient. How else could I make the code so as to create an Object variable as in the example above?

