title: Javascript Arrays within Arrays lost
body: <p>I created an array of strings in JS.</p>
  
  <pre><code>arr1 = [];
  for (...)
    arr1.push('aasfd');
  </code></pre>
  
  <p>Now I add this array to another array contained in some other object.</p>
  
  <pre><code>arr2 = [];
  arr2.push(arr1);
  console.log(arr2);
  </code></pre>
  
  <p>The last log statement shows the expected array.</p>
  
  <pre><code>[
   Array[3]
   0: "A"
   1: "B"
   2: "C"
   length: 3
   __proto__: Array[0]
  ]
  </code></pre>
  
  <p>After a while, some event handler gets invoked and it turns out the contents of arr2 are undefined. I am pretty sure that no function in the object containing arr2 is invoked between the two callbacks.</p>
  
  <p>arr2 becomes</p>
  
  <pre><code>[undefined x 1]
  </code></pre>
  
  <p>No idea where the array arr1 contained within arr2 is getting lost. Am I missing something? How do I debug this error?</p>