title: Javascript Color Guessing Game for my course work
body: <p>I need help with my coding. I am new to this and just starting out on this great journey. When I start the game, the dialog box comes up for me to answer but when I submit a color, it just goes away. Any help would be appreciated.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"/&gt;
  &lt;title&gt;Color Guessing Game&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Color Guessing Game&lt;/h1&gt;
      &lt;button type="button" onclick ="runGame()"&gt;Start Game&lt;/button&gt;
      &lt;script&gt;
          const COLORS_ARRAY = ['blue', 'cyan','gold','gray','green','magenta','orange','red','white','yellow.']
          function runGame(){
          let guess = ' ';
          let correct = false;
          let numTries = 0;
          const targetIndex = Math.floor(Math.random() * COLORS_ARRAY.length);
          const target = COLORS_ARRAY[targetIndex];
          console.log(target)
             
          
              do{
              guess = prompt('I am thinking of one of these colors:\n\n' + COLORS_ARRAY +'What color am I thinking of?\n');
              numTries += 1;
              if(guess === null){
              alert('Have a great day!');
              }
              return false;
              correct = checkGuess (guess, target);
              } while(!correct);
               alert("Congrats! You got it"+ target + " \n\nIt took you" + numtries + "tries to guess correctly"); 
               document.body.style.background = guess;
          }     
              function checkGuess(guess,target){
              let correct = false;
              console.log (guess);
              if (!COLORS_ARRAY.includes(guess)){
                  alert('You have not entered a color from the list\n\nPlease choose a color from the before mentioned list.');
              }else if (guess &gt; target) {
                  alert('Your choice is alphabetically higher than the color.');
              }else if (guess &lt; target) {
                  alert('Your choice is alphabetically lower than the color.');
              }else {
              correct= true;
              }
              return correct;
              }
             
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>