Can someone explain why this code always returns false even when I enter "abcdef" into the prompt, which should make it return true?
var userinput = prompt('Enter characters:');
var lowercase = userinput.toLowerCase();
var allowedcharacters = ["a", "b", "c", "d", "e", "f"]
function match(input, statement) {
for (var i = 0; i < statement.length; i++) {
if (input.indexOf(statement[i]) == -1) {
return false;
}
}
return true;
}
if (lowercase == allowedcharacters){
alert(true);
}
else{
alert(false);
}