title: Javascript object reference linked to object in array?
body: <p>If I have an object:</p>
  
  <pre><code>var array = [];
  var theobject = null;
  
  array.push({song:"The Song", artist:"The Artist"}, {song:"Another Song", artist:"Another Artist"});
  </code></pre>
  
  <p>and I do:</p>
  
  <pre><code>for(var i = 0; i &lt; array.length; i++)
  if(array[i].song == "The Song") {
  theobject = array[i];
  break;
  }
  </code></pre>
  
  <p>If I then change theobject by doing:</p>
  
  <pre><code>theobject.song = "Changed Name";
  </code></pre>
  
  <p>I am having problems where despite myself trying to set ONLY "theobject.song" to be equal to "Changed Name", array[0].song becomes set to "Changed Name" also. </p>
  
  <p>What I want is "theobject.song" to become "Changed Name" while array[0].song remains "The Song".</p>
  
  <p>What is the best way to accomplish this?</p>