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)