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)