JSFiddle - React, Tailwind, and code Playground

JavaScript

x = [[1,2,3,4],
    [5,6,7,8],
    [9,10,11,12]
];
var sum = function(arr) {
  return arr.reduce(function(a, b){ return a + b; }, 0);
};

// vertical sums
x.map(function(row, i) {
  console.log(sum(x.map(function(row) { return row[i]; })));
});