title: Javascript Checking array for presence of a specific number
body: <p>I have search through quite a lot of questions here, but havent found one that i think fits my bill, so if you know of one please link to it.</p>
  
  <p>I have an array that i want to search through for a specific number and if that number is in the array, i then want to take an action and if not then another action.</p>
  
  <p>I have something like this</p>
  
  <pre><code>var Array = ["1","8","17","14","11","20","2","6"];
  
  for(x=0;x&lt;=Array.length;x++)
  {
      if(Array[x]==8)
          then change picture.src to srcpicture1
      else
          then change picture.src to srcpicture2
  }
  </code></pre>
  
  <p>but this will run the lenght of the array and end up checking the last element of the array and since the last element is not 8 then it will change the picture to picture2.</p>
  
  <p>Now i can see why this happens, i just dont have any ideas as to how to go about checking if an array contains a specific number.</p>
  
  <p>Thanks in advance.</p>