title: how to iterate through nested array items separately
body: <p>I have a three-dimensional array, for example:</p>
  
  <p><code>var array = [[1,0][3,3][2,1][0,8]]</code></p>
  
  <p>and I want to do something with the first item in each sub-array, but something else with the second item in each sub-array. </p>
  
  <p>So, for example, I would like to find the sum of <code>array[0][0], array[1][0], array[2][0]</code> and so on for <code>array.length</code>. But, I would like a separate result for <code>array[0][1], array[1][1], array[2][1]</code>, etc.</p>
  
  <p>I'm still learning javascript (very slowly) and, if possible, I would like to be pointed in the right direction, rather than getting a ready-made solution. I've been looking for possible solutions, and I think I may need a nested <code>for</code> loop, but I'm not sure how to structure it to get all the values.</p>
  
  <p>I've been trying something along the lines of:</p>
  
  <pre><code>for (var i = 0; i &lt; array.length; i++) {
    for (var j = 0; j &lt; array.length; j++) {
      return array[i][j];
    }
  }
  </code></pre>
  
  <p>but I don't understand what's happening well enough to manipulate the result.</p>
  
  <p>If anyone could steer me in the right direction toward finding a solution, that'd be much appreciated.</p>
  
  <p>Thanks in advance.</p>