DEV Community

Discussion on: Write Cleaner JavaScript Code With .some() And .every() Array Methods

Collapse
 
aritdeveloper profile image
Arit Developer

Excellent post - short and sweet! 🍬

In your .some() example, perhaps changing the variable name to something more appropriate? Since .some() requires only one comparison to return true:

const oneOrMoreAboveAge = people.some(person => person.age >= 18)
Collapse
 
themarcba profile image
Marc Backes

You’re completely right. Fixed it πŸ‘