I am trying to ge to see if an array has an exact match to a value. This is what I have so far but it doesn't work. If I search for 'leo' I should get no result but in this case both items in the array both match the value. Does anyone know how to find if there is an exact match in the array? Thanks
var array = ['leon','leonardo'];
array.indexOf('leo')
The code you have should work just fine. How are you checking the result?
array.indexOf('leo')
will return -1
if no match is found.