loading...

Array.every()

318097 profile image Mehul Lakhanpal Originally published at codedrops.tech ・1 min read

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

Thanks for reading 💙

Follow @codedrops.tech for daily posts.

InstagramTwitterFacebook

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

codedrops.tech

Discussion

pic
Editor guide
Collapse
zdev1official profile image
ZDev1Official

Good, thanks

Collapse
dcsan profile image
dc

underrated API :D

Collapse
318097 profile image
Mehul Lakhanpal Author

Haha.. But it might be of use someday 😅