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 😅