A collection of codes containing the solution you are looking for.
A collection of codes containing the solution you are looking for.
function mat_add(a,b) { //Logic var p = a.length; var q = a[0].length; c = Array(p).fill(0).map(x => Array(q).fill(0)); for(var i = 0; i < p; i++) { for(var j = 0; j < q; j++) { c[i][j] = a[i][j] + b[i][j]; } } return c; }