title: Pushing an array to another array
body: <p>I'm new to javascript and I've been going through some exercises but I can't figure out why  this code works like this,</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    let newArray = [];
      let arr1 = [];
      for (let i = 0; i &lt; 2; i++) {
  
        for (let j = 0; j &lt; 2; j++) {
  
          arr1.push(0);
          //console.log('Arr1:',arr1); 
        }
  
        newArray.push(arr1);
        //console.log('New Array:', newArray)
        
      }
      console.log(newArray);
    </code></pre>
  </div>
  </div>
  </p>
  <p>According to me, this block of code should output [[0,0][0,0,0,0]] but the real output is [[0,0,0,0][0,0,0,0]].</p>
  <p>I tried console logging after every iteration(by removing the comments) and I can't seem to find where it goes wrong. It seems like it all goes well until the last log. I'd appreciate your help.</p>