Checking If Every Element Passes a Test in Javascript


every checks if all elements in an array pass a test.

Source Code

let ages = [22, 33, 16, 40];
let allAdults = ages.every(age => age >= 18);
console.log(allAdults);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments