title: JavaScript - an array in if statement
body: <p>I really need some help with this one, I've been struggling a lot trying to crack the example down on my own for way too long.. the whole issue is that I have an array that includes 15 pictures added by push property &amp; createImage function, the problem though is that I've absolutely no idea how I could use the image in an if-statement like so: </p>
  
  <p>if (check both if the image displayed is the first image within the array and answer equals 'x') return that's a good answer
  that's a good answer } else (in case if either the image isn't the first one or answer doesn't equal 'x' return that's not a good answer</p>
  
  <p>So far I've achieved the following, unfortunately enough the program omits the rule regarding the array</p>
  
  <pre><code>var answer = document.getElementById("answer");
  var image = newArray[0];
  
      function check() {
          if (newArray[0] == true &amp;&amp; answer.value == "C") {
              window.alert("that's a good answer");
          } else if (newArray[0] == true &amp;&amp; answer.value == "c") {
              window.alert("that's a good answer as well");
          } else {
              window.alert("that's unfortunately not a good answer");
          }
      }
  </code></pre>
  
  <p>Thanks in advance for any form of help</p>