title: Making a javascript hangman game and I can't get my function to apply to repeated letters
body: <p>Everything about the script works great right now unless there's a repeated letter in the word. If so, then it will only display the first of the letters. For example, if the random word is "look" it would display like this "lo k".</p>
  
  <p>Unfortunately the only other related javascript hangman question here was for a script that didn't actually have issues on repeated letters. For reference: <a href="https://stackoverflow.com/questions/25336880/how-to-deal-with-repeated-letters-in-a-javascript-hangman-game">how to deal with repeated letters in a javascript hangman game</a>. Can anyone help me get through the repeated letter issue? Thanks!</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;script src="js/jquery-1.11.2.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/jquery-1.11.2.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="css/main.css"&gt;
      &lt;title&gt;Hang a Blue Devil&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div class="wrapper"&gt;
  
          &lt;h1 class="title"&gt;Hangman&lt;/h1&gt;
          &lt;h2 class="attempt-title"&gt;You have this many attempts left: &lt;/h2&gt;
  
        &lt;ul class="hangman-word"&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
          &lt;li class="tester"&gt;&lt;/li&gt;
        &lt;/ul&gt;
  
          &lt;h3 class="hangman-letters"&gt;&lt;/h3&gt;
  
        &lt;input class="text-value" type="text" maxlength="1" onchange="setGuess(this.value)"&gt;
        &lt;button class="text-button" onclick="checkGuess()"&gt;&lt;/button&gt;
  
          &lt;p class="letters-guessed"&gt;&lt;/p&gt;
  
      &lt;/div&gt;
    &lt;/body&gt;
    &lt;script src="js/hangman.js"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My JS:</p>
  
  <pre><code>var hangmanWords = [
    "the","of","and","a","to","in","is","you","that","it","he",
    "was","for","on","are","as","with","his","they","I","at","be",
    "this","have","from","or","one","had","by","word","but","not",
    "what","all","were","we","when","your","can","said","there",
    "use","an","each","which","she","do","how","their","if","will",
    "up","other","about","out","many","then","them","these","so",
    "some","her","would","make","like","him","into","time","has",
    "look","two","more","write","go","see","number","no","way",
    "could","people","my","than","first","water","been","call",
    "who","oil","its","now","find","long","down","day","did","get",
    "come","made","may","part"
  ];
  
  // declared variables
  
  var randomNumber = Math.floor(Math.random() * 100);
  var randomWord = hangmanWords[randomNumber];
  var underscoreCount = randomWord.length;
  var underscoreArr = [];
  var counter = randomWord.length +3;
  var numberTest = 0;
  var lettersGuessedArr = [];
  
  
  var lettersGuessedClass = document.querySelector('.letters-guessed');
  var li = document.getElementsByClassName('tester');
  var textValue = document.querySelector('.text-value');
  var attemptTitle = document.querySelector('.attempt-title');
  var hangmanWordClass = document.querySelector('.hangman-word');
  var hangmanLettersClass = document.querySelector('.hangman-letters');
  
  // actions
  
  attemptTitle.innerHTML = "You have this many attempts left: " + counter;
  console.log(randomWord);
  
  function setGuess(guess) {
    personGuess = guess;
  }
  
  for (i=0;i&lt;underscoreCount;i+=1) {
    underscoreArr.push("_ ");
    underscoreArr.join(" ");
    var underscoreArrString = underscoreArr.toString();
    var underscoreArrEdited = underscoreArrString.replace(/,/g," ");
    hangmanLettersClass.innerHTML = underscoreArrEdited;
  }
  
  function pushGuess () {
        lettersGuessedArr.push(personGuess);
        var lettersGuessedArrString = lettersGuessedArr.toString();
        var lettersGuessedArrEdited = lettersGuessedArrString.replace(/,/g," ");
        lettersGuessedClass.innerHTML = lettersGuessedArrEdited;
  }
  
  function checkGuess() {
    for (var i=0;i&lt;randomWord.length;i+=1) {
      if (personGuess === randomWord[i]) {
          console.log(personGuess);
          numberTest = i;
          li[i].textContent = randomWord[i];
          i += 20;
          textValue.value= "";
      } else if ((randomWord.length - 1) &gt; i ) {
          console.log("works");
      } else {
          pushGuess();
          counter -= 1;
          attemptTitle.innerHTML = "You have made this many attempts: " + counter;
          textValue.value= "";
      }
    }
  };
  </code></pre>
  
  <p>My bin:
  <a href="http://jsbin.com/dawewiyipe/4/edit" rel="nofollow noreferrer">http://jsbin.com/dawewiyipe/4/edit</a></p>