I have a nested array like this.
var arr = [[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false]]
I want to check if every value is false. I could think of one way of doing this.
let sum = 0;
arr.forEach((row, i) => {
row.forEach((col, j) => {
sum = sum +arr[i][j]
});
});
if(sum === 0){
console.log("all values false")
}
This works. But I'm curious if there is a better way? to check if all values are true or false?