DEV Community

loading...

Array.some()

318097 profile image Mehul Lakhanpal ・1 min read

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

Discussion (0)

pic
Editor guide