title: Sum array values in object of arrays
body: <p>I'm looking to sum positions in an object of arrays. Essentially, each number represents a yearly amount for an expense line item, and I need to sum these up for each year. The object looks like this (see below) and the result should be an array which = [1500, 1900, 2400] given the object below. </p>
  
  <pre><code>x = [{
        "HVAC": [100, 200, 300, 400],
        "foundation": [500, 600, 700, 800],
        "roof": [900, 1000, 1100, 1200]
      }];
  </code></pre>
  
  <p>If the arrays weren't named, and instead looked like:</p>
  
  <pre><code>x = [
            [100, 200, 300, 400],
            [500, 600, 700, 800],
            [900, 1000, 1100, 1200]
          ];
  </code></pre>
  
  <p>Then this function would do what I want (thanks to this post <a href="https://stackoverflow.com/questions/32139773/sum-array-of-arrays-matrix-vertically-efficiently-elegantly">Sum array of arrays (matrix) vertically efficiently/elegantly</a>): </p>
  
  <pre><code> $scope.reserveTotals = x.reduce(function(a, b) {
        return a.map(function(v, i) {
          return v + b[i];
        });
      });
  </code></pre>
  
  <p>As it stands, I need to keep the original structure and am just struggling to adapt that function do what I need. Any help appreciated!</p>