title: check if value exists in the array
body: <p>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?</p>
  
  <pre><code>function checkarray() {
    var ID = document.getElementById('input2').value
    for (var i = 0; i &lt; array.length; i++) {
      if (ID == array[i]) {
        ID = "correct"
      } else {
        ID = "incorrect"
      }
    }
    document.getElementById('message').innerHTML = ID;
  }
  </code></pre>