matrixAdd = (mat1, mat2) => {
  console.assert(mat1.length === mat2.length, 'Dimension not matching');
  console.assert(mat1[0].length === mat2[0].length, 'Dimension not matching');

  let result = init2DArray(mat1.length, mat1.length, 0);

  for (let i = 0; i < mat1.length; i++) {
    for (let j = 0; j < mat1.length; j++) {
      result[i][j] = mat1[i][j] + mat2[i][j];
    }
  }

  return result;
}
Matrix elementwise addition.
@param {[[number]]} mat1 Matrix 1
@param {[[number]]} mat2 Matrix 2