Check if all the elements in the array are greater than 0
using .every()
.
const arr = [1, 2, -1, 4, -5];
const allGreaterThanZero = arr.every(number => number > 0);
console.log(allGreaterThanZero); // false
Thanks for reading π
Follow @codedrops.tech for daily posts.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Top comments (3)
Good, thanks
underrated API :D
Haha.. But it might be of use someday π