I have a functions which asks the users to write their favorites animals ant then stores it in an array called animals.When a user executes the function I want to check if the animal he wants is inside the array and if yes to show the index of the animal(for example:The animal you entered is already in the array.Its index number is...).Any ideas?
var animals=[]
function anim(){
var ani=prompt("Give me an animal you like");
animals.push(ani);
}