I want to check if the value entered by the user matches one of the values in my array. The below code is what I've got so far. Except at the moment no matter what I enter it always says "incorrect". Can someone tell me why this is and provide a possible fix?
function checkarray() {
var ID = document.getElementById('input2').value
for (var i = 0; i < array.length; i++) {
if (ID == array[i]) {
ID = "correct"
} else {
ID = "incorrect"
}
}
document.getElementById('message').innerHTML = ID;
}