Is there a smart way to find out if there are at least two values greater than 0 in an array and return true
? And false
in the opposite case?
(hypothetical and wrong example using some):
const a = [9, 1, 0];
const b = [0, 0, 0];
const c = [5, 0, 0];
const cond = (el) => el > 0 && somethingElseMaybe;
console.log(a.some(cond)); // print true
console.log(b.some(cond)); // print false
console.log(c.some(cond)); // print false