Checking if every array element matches a condition
const isEverybodyOver18 = ages => ages.every(age => age > 18) isEverybodyOver18([27, 35, 52, 91]) // ⇒ true isEverybodyOver18([16, 23, 42, 19]) // ⇒ false
There is more to learn
Get free previews of my upcoming course materials and other bonus content to help you work smarter. I share tips straight to your inbox once a week. You can read previous mails in the newsletter archive.
Cannot show form because cookie consent was not given.