Nicanor13,
const sumArr = a => a.reduce((a,b) => a + b, 0);
const matrixСolumns = a => {
const {length} = a;
const columns = [];
for (let i = 0; i < length; i++) {
let temp = columns[i] = [];
for (let j = 0; j < length; j++) {
temp.push(a[j][i])
}
}
return columns;
}
function decimalSubMatrix(matrix)
{ let sumTotal = sumArr(matrix.map(sumArr));
if(sumTotal < 20) return false;
const max = sumTotal - 10;
const arr = matrix.slice(0).concat(matrixСolumns(matrix));
return arr.every(a => sumArr(a) <= max)
}
console.log(decimalSubMatrix([[5, 0, 5],[0, 0, 0],[5, 0, 5]])) // true
console.log(decimalSubMatrix([[2, 4, 6],[2, 2, 2],[4, 8, 8]])) // true
console.log(decimalSubMatrix([[1, 1, 1],[1, 1, 1],[1, 2, 1]])) // false
console.log(decimalSubMatrix([[4, 6, 8, 1],[2, 3, 5, 6],[1, 2, 8, 1], [9, 1, 0, 3]])) // true
console.log(decimalSubMatrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])) // false