DEV Community

Discussion on: Quick JavaScript Tip: the some() method

Collapse
 
nirmalpatel59 profile image
nirmalpatel59

can't we use simply animals.indexOf("snakes") > -1

Collapse
 
kip13 profile image
kip
Collapse
 
mattsparks profile image
Matt Sparks

You can! That's the beauty of code, there's usually more than one way to solve a problem. It all comes down to preference and the task at hand.