title: Javascript: confused about how nested for loops work
body: <p>Why do nested <code>for loops</code> work in the way that they do in the following example:</p>
  
  <pre><code>var times = [
              ["04/11/10", "86kg"], 
              ["05/12/11", "90kg"],
              ["06/12/11", "89kg"]
  ];
  
  for (var i = 0; i &lt; times.length; i++) {
          var newTimes = [];
          for(var x = 0; x &lt; times[i].length; x++) {
              newTimes.push(times[i][x]);
              console.log(newTimes);  
  
  
          }
  
      }
  </code></pre>
  
  <p>In this example I would have thought console.log would give me the following output:</p>
  
  <pre><code>["04/11/10"]
  ["86kg"]
  ["05/12/11"]
  ["90kg"]
  ["06/12/11"]
  ["89kg"]
  </code></pre>
  
  <p>However, I actually get this:</p>
  
  <pre><code>["04/11/10"]
  ["04/11/10", "86kg"]
  ["05/12/11"]
  ["05/12/11", "90kg"]
  ["06/12/11"]
  ["06/12/11", "89kg"]
  </code></pre>
  
  <p>Is anyone able to help me understand this?</p>
  
  <p>EDIT:</p>
  
  <p>Thanks for all your responses!</p>