Working with associative arrays in javascript
<p>I want to use a variable as index of my associative array</p>

<pre><code>var usersName = []; // Just defining
userName[socket.id] = socket.name; // socket.id is an alphanumeric string
</code></pre>

<p>I want to use that <code>socket.id</code>(string) as the custom index of <code>usersName</code> array, so I can get a list of all the users connected to the socket. The problem is the way I'm escaping the variable ( I guess).</p>

<p>I've tried this but didn't work:</p>

<pre><code>usersName ['\''+socket.id+'\''] = socket.name;
</code></pre>

<p>This works in PHP but, I just can't get it to work in javascript</p>

<p>Thanks for the help.</p>
