I have a two-dimensional array, the cells are an object {id, amount}, you need to add a sum of columns, while using only methods. What I did -
let matrix = [
[{id:1, amount:11},{id:2, amount:22},{id:3, amount:33}],
[{id:4, amount:44},{id:5, amount:55},{id:6, amount:66}],
[{id:7, amount:77},{id:8, amount:88},{id:9, amount:99}],
[{id:10, amount:100},{id:11, amount:111},{id:12, amount:112}],
];
let c = matrix.reduce((acc, cur)=> {
return acc.map((item, index)=> {
return item + cur[index].amount;
})
});
console.log(c);