This works:
var animals = ["caterpillar", "dog", "bird"];
var catMatch = /cat/i;
var catFound = animals.some(function(animalName) {
return catMatch.test(animalName);
});
console.log(catFound);
But this doesn't
var animals = ["caterpillar", "dog", "bird"];
var catMatch = /cat/i;
var catFound = animals.some(catMatch.test);
console.log(catFound);
Why doesn't the second version work?