I am having trouble comparing strings in this array. For some reason, the strings are never equal.
var person = ["Sam", "John", "Mary", "Liz"];
var searchedName = prompt("Enter name");
var resultMessage = "";
for (index in person) {
var currentName = person[index];
if (currentName === searchedName){
resultMessage = "Found Person";
} else {
resultMessage = "No match found!";
}
}
console.log(resultMessage);