I want to be able to search an array with the input a user has entered. So for example if the user enters "18" into the input field, either "value not found" would appear or "value found" would appear depending on whether the number 18 was in the array.
This is what I have so far.
var search = document.getElementById("search");
var arr = [18,23,20,17,21,18,22,19,18,20];
function beginhere() {
var input = document.getElementById("Input").value;
for (i=0; i<arr.length; i++){
if (arr[i] == Input) {
alert(arr[i]);
} else {
alert("Value not found");
}
}
};