title: javascript return reference to array item
body: <p>I have a array like this:</p>
  
  <pre><code>users = [{id:1, name:'name1'},{id:2, name:'name2'}]
  </code></pre>
  
  <p>How could I get a reference to the item {id:2, name:'name2'}, so I can change it is name property, like:</p>
  
  <pre><code>user = get_item(users, 'id', 2);
  user.name = "user2 name changed";
  </code></pre>
  
  <p>console.log(users) will have the result:</p>
  
  <pre><code>[{id:1, name:'name1'},{id:2, name:'user2 name changed'}]
  </code></pre>
  
  <p>I tried to use Array.filter() function, but it returns a new array instead of a reference to the original array. which I can not use to mutate the original array.</p>
  
  <p>Any idea?</p>