To check if some element is false in an array in JavaScript:
javascript// First example, one element is false let arr = [true, false, true, true]; let res = arr.some(elem => elem === false); console.log(res); // true
Second example:
javascript// Second example, all elements are true let arr = [true, true, true, true]; let res = arr.some(elem => elem === false); console.log(res); // false
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.