Hangman game issue
<p>I am new to javascript and am trying to make a Hangman game. I am at the point where a for loop checks the users input and if it matches, it should replace one of the underscores that is generated. How do I have the user input(ex: a or d) replace one of the underscores? I've tried splicing, and using the .replace method. Here is the fiddle: <a href="https://jsfiddle.net/jtpsj5eu/18/" rel="nofollow">https://jsfiddle.net/jtpsj5eu/18/</a></p>

<p>Here is the loop in question: </p>

<pre class="lang-js prettyprint-override"><code>for (i = 0; i &lt; hangv.input.length; i++) {

  //if user's guess is matched against one of the letters of the word, this will execute. 
  if (guess == hangv.input[i]) {
    //replace underscores with guessed letter 
    newStr = guessa.slice(hangv.input[i], hangv.input[i]) + guess + guessa.slice(hangv.input[i] + 1);
    console.log(newStr);
  } else {
    console.log("false");
  }
}
</code></pre>