Getting: RangeError: Maximum call stack size exceeded

I am creating a game using node js and socket IO.

I am creating players as following

  var player =  new playa.playa();
        player.name = info.name;
        player.picture = info.picture;
        player.email = info.email;
        player.user_id = info.user_id;
        player.socket = socket;

I then add the player to my array

      playerPool[info.user_id] = player;

mapped so I can then reference playerPool[user_Id] without having to iterate through the loop

i Then want to add my player to my game

        g.addPlayer(playerPool[info.user_id]);


        this.addPlayer = function(player)
        {
            var self = this;
            if(this.max_players > this.current_players.length)
            {
                 self.current_players[player_userid] =player;
            }
         }

However, I keep getting an error

for(var key in obj)  RangeError max call stack size exceeded

My question is

  1. why is JavaScript looping through my keys?

if I Call

       player.user_id

it returns the user id of the player class, so I know it is a valid object.

I never asked JavaScript to iterate through the object, just re map it to the players array in the game class just as I did to my player pool. However this seems to be an issue. Did anyone incur the same problem?

the syntax of the for loop does precisely that only, it loops through the key values of that object

so the syntax

for(var key in obj) 

would give the keys of that object i.e. the properties. In order to access the object values you need to use obj[key] in this for loop.

Another way to get the values of the array that you create would be:

playerPool.forEach(function(player) {
   //Over here you get each player in the array
});