Check if 1 or more elements in the array are greater that 0
using .some()
.
const arr = [1, 2, -1, 4, -5];
const someGreaterThanZero = arr.some(number => number > 0);
console.log(someGreaterThanZero); // true
Thanks for reading π
Follow @codedrops.tech for daily posts.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Top comments (0)