title: Does array assignment create a new reference
body: <p>I am running into the following situation. I am initializing an array, and assigning it to an object's property.</p>
  
  <pre><code>var arr = [1,2,3,4,5];
  var obj = { 'numbers': arr };
  </code></pre>
  
  <p>I understand that I passed a reference to my array <code>arr</code> to my object <code>obj</code>. So I can do the following:</p>
  
  <pre><code>arr.push(6);
  console.log(obj);
  </code></pre>
  
  <p>will display the following, as expected:</p>
  
  <pre><code>{ numbers: [ 1, 2, 3, 4, 5, 6] }
  </code></pre>
  
  <p>Now for the unexpected part. The value of <code>arr</code> changes, through an external event, and I want the value of <code>obj.numbers</code> to change at the same time. But it does not:</p>
  
  <pre><code>arr = [0,0,0,0,0];
  console.log(arr);
  console.log(obj);
  arr --&gt; [0,0,0,0,0]
  obj --&gt; { numbers: [ 1, 2, 3, 4, 5, 6] }
  </code></pre>
  
  <p>So the value of my <code>arr</code> variable changed, but not the <code>numbers</code> property in my <code>obj</code> variable.</p>
  
  <p>So, my only explanation is, that as soon as you perform an assignment to an array, you break the old reference and create a new reference. Is that so?</p>
  
  <p>And how would I assign my new values <code>[0,0,0,0,0]</code> to my <code>arr</code> variable and the <code>obj.numbers</code> (at the same time)?</p>