title: How do I target an object with a specific variable in javascript
body: <p>I'm making an online game where users have different ID's.</p>
  
  <p>Here's the client code for creating a new player:</p>
  
  <pre><code>var newPlayer = function(id){
     return player[player.length]={
        x:0,
        y:0,
        id:id
     }
  }
  </code></pre>
  
  <p><code>newPlayer(50)</code> would create a player with the ID 50.</p>
  
  <p>How do I select that player based on its <code>id</code> variable?</p>
  
  <p>Thanks</p>