title: javascript add multidimensional array values to new array
body: <p>I have an multidimensional array like </p>
  
  <pre><code>var arr = [[1,2,3],[1,3,2],[1,1,1]];
  </code></pre>
  
  <p>and I would like to add up what would be a matrix column for each column into a new array. The result I am expect would be [3,6,6].  This is the solution I came up with</p>
  
  <pre><code>function compute(arr) {
      var X = _.reduce(arr, function(acc, j) {
          acc += j[0];
          return acc;
      },0);
      var Y = _.reduce(arr, function(acc, k) {
          acc += k[1];
          return acc;
      },0);
      var Z = _.reduce(arr, function(acc, l) {
          acc += l[2];
          return acc;
      },0);
      return [X,Y,Z];
  }
  </code></pre>
  
  <p>It is working but seems redudent to have 3 reduce functions.  I am looking for a cleaner, more functional, faster solution using lodash.  </p>
  
  <p>I was thinking maybe I could use the _.flatten function since you can pass it a function for each iteration but I can't seem to avoid all the looping.  Any suggestions?</p>