title: getting the prompt to recognize the letters in a javascript hangman games "chosen word"
body: <p>so i am trying to teach myself javascript and have decided to try and make a basic hangman game, as it seems to be a popular interview/test question. My plan is to use Math.random to pick a select word out of a pool of words, and then use the prompt feature to find the letters of the word. Unfortunately, I have been unable to figure out how to get the prompt to recognize my input. 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-js lang-js prettyprint-override"><code>var secretWords = ["batman", "Donkey kong", "ninja", "programming"];
  var chosenWord = secretWords[Math.floor(Math.random() * secretWords.length)];
  var guesses = 8;
  var letters = chosenWord.length
  var guess = prompt("GUESS A LETTER");
  
  
  alert(chosenWord);
  
  for (var i = 0; i &lt;= letters; i++) {
    letters[i] = chosenWord.substring(i, i++)
  }
  if (guess = i) {
    alert("nice")
  } else {
    alert("Wrong");
  }</code></pre>
  </div>
  </div>
  </p>