var animals = ['dog', 'cat=123', 'hamster', 'bird', 'fish', 'cacaca']; var index = animals.findIndex( function checkNumber( currentValue ) { return currentValue.slice(0, 2) == 'ca' ; } ); alert(index);