DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on

Array.some()

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
Enter fullscreen mode Exit fullscreen mode

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)