title: Remove node element without removing innerHTML
body: <p>I'm refactoring a vanilla JS Wheel of Fortune/Hangman game and I'm trying to figure out how to remove the previous node elements displayed in the underscores representing the letters in the word the user is trying to guess. If the user picks a word that's 5-6 letters, that usually fine because the next random word is probably more than 5-6 letters so it will overwrite the shorter array of underscores. My problem is, a word like "JAVASCRIPT", causes problems. If the user gets "ARRAYS", the "RIPT" from the previous "JAVASCRIPT" remains on the page. I tried several things like window.location.reload(), but I don't want to reload the page each time the user guesses the word correctly since I want to add a point-based system. I tried wordDisplay.remove() but no luck. Lastly, I tried </p>
  
  <pre><code>wordDisplay.childNodes.forEach(child =&gt; {
      wordDisplay.removeChild(child);
   });
  </code></pre>
  
  <p>but this doesn't allow the underscores to show once the play button is hit. It also doesn't completely solve the problem of resetting the childNodes in wordDisplay. Any ideas how I can fix this problem?</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>let guessesLeft,
      letterClicked,
      wordChoice,
      remainingLetters,
      answerList = [],
      wordArray = ["JAVASCRIPT", "ARRAYS", "FUNCTIONS", "HOISTING", "RECURSION", "EVENTS", "KEYUP", "TERNARY"],
      hint = document.querySelector(".hint"),
      letterGuessed = document.querySelector("#your-guess"),
      numbers = document.querySelector("#numbers"),
      guesses = document.querySelector("#guesses"),
      wordDisplay = document.querySelector("#words"),
      letterCount = document.querySelector(".letters"),
      newGame = document.querySelector("#play"),
      letterBoxes = document.querySelector("#alphabet"),
      titleHeader = document.querySelector(".welcome"),
      pointTotal = document.querySelector("#pointTotal");
  
  function playGame() {
  
      guessesLeft = 6;
      guesses.innerHTML = `You have ${guessesLeft} guesses left`;
      // Pick a random word.
      wordChoice = wordArray[Math.floor(Math.random() * wordArray.length)];
  
      for (var i = 0; i &lt; wordChoice.length; i++) {
          answerList[i] = "_";
      }
      // Display underscores on page representing each letter in the random word
      wordDisplay.innerHTML = answerList.join('');
  
      let hintObject = {
          JAVASCRIPT: "The language of the web",
          ARRAYS: "Similar to objects",
          FUNCTIONS: "Stores instructions",
          HOISTING: "Moving declarations to the top",
          RECURSION: "Calling functions inside of functions",
          EVENTS: "This happens to HTML elements; like a concert",
          KEYUP: "Not 'keydown', but...",
          TERNARY: "Type of operator"
      }
  
      hint.innerHTML = `Clue: ${hintObject[wordChoice]}`;
  
      // Display number of letters in the random word on the page
      remainingLetters = wordChoice.length;
      letterCount.innerHTML = `The word is ${remainingLetters} letters long`;
  
      // wordDisplay.childNodes.forEach(child =&gt; {
      //     wordDisplay.removeChild(child);
      // });
  }
  
  // Register the player’s guess.
  function buttonPress(e) {
      letterClicked = e.target.textContent;
      letterGuessed.innerHTML = `You guessed the letter ${letterClicked}`;
      matchWord(letterClicked);
  }
  
  // Pass the letter event from buttonPress into the randomWord function
  function matchWord(letter) {
      pointTotal = 0;
      if (remainingLetters &gt; 0) {
          let foundMatch = false;
  
          for (var i = 0; i &lt; wordChoice.length; i++) {
              if (wordChoice[i] === letter) {
                  foundMatch = true;
                  answerList[i] = letter;
                  wordDisplay.innerHTML = answerList.join(' ');
                  remainingLetters--;
              }
          }
  
          if (!foundMatch) {
              guessesLeft--;
              guesses.innerHTML = (`You have ${guessesLeft} guesses left`);
          }
  
          if (guessesLeft === 0) {
              hint.innerHTML = "Sorry, you're out of guesses!";
              setTimeout(function () {
                  hint.innerHTML = "If you'd like to play again, click the spin button.";
                  letterCount.innerHTML = "You lost :(";
              }, 3000);
          }
  
          if (remainingLetters === 0) {
              hint.innerHTML = "Great job! You guessed it!";
              pointTotal++;
              setTimeout(function () {
                  playGame();
              }, 3000);
          }
      }
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
      background: linear-gradient(200deg, #025302, #027740, #05b965, #07e07b, #05532f);
      background-size: contain;
      color: white;
      font-family: 'Merriweather', serif;
      text-shadow: 2px 2px 3px rgb(27, 22, 22);
  }
  
  #container {
      display: block;
      margin: 20px;
  }
  
  #roundsWon {
      margin-left: 15%;
      font-size: 45px;
  }
  
  .welcome {
      font-size: 80px;
      letter-spacing: 5px;
      text-align: center;
  }
  
  .letters, .lives {
      font-size: 30px;
      text-align: center;
  }
  
  .hint {
      font-size: 35px;
      text-align: center;
  }
  
  #words {
      justify-content: center;
      text-align: center;
      font-size: 50px;
      margin: 10px;
      letter-spacing: 20px;
  }
  
  #alphabet {
      margin: 0 auto;
      width: 990px;
  }
  
  #letterChoices {
      padding: 5px;
      margin: 5px;
      width: 2em;
      height: 10%;
      font-size: 2em;
      border: 2px solid white;
      text-align: center;
      box-shadow: 2px 2px 3px black;
  }
  
  #play {
      float: left;
      margin: 20px auto;
      font-size: 60px;
  }
  
  #your-guess {
      float: right;
      margin-right: 5%;
      font-size: 40px;
      color: #bada55;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
          &lt;html&gt;
          &lt;head&gt;
              &lt;meta charset="utf-8" /&gt;
              &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
              &lt;title&gt;Wheel of Fortune&lt;/title&gt;
              &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"&gt;
              &lt;link rel="stylesheet" href="main.css"&gt;
              &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"&gt;
              &lt;link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet"&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;div class="Title"&gt;
                  &lt;h1 class="welcome"&gt;Welcome to Wheel of Fortune!&lt;/h1&gt;
              &lt;/div&gt;
                  &lt;div id="alphabet" onclick="buttonPress(event)"&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;A&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;B&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;C&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;D&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;E&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;F&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;G&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;H&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;I&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;J&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;K&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;L&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;M&lt;/a&gt;
                  &lt;/br&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;N&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;O&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;P&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;Q&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;R&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;S&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;T&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;U&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;V&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;W&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;X&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;Y&lt;/a&gt;
                      &lt;a id="letterChoices" class="waves-effect waves-light btn-large"&gt;Z&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div id="container"&gt;
                      &lt;div id="header"&gt;
                          &lt;p class="hint"&gt;Hint will display once you spin&lt;/p&gt;
                          &lt;!-- The letters will be tied to the number of letters in the random array --&gt;
                          &lt;p class="letters"&gt;The word is &lt;span id="numbers"&gt;_&lt;/span&gt; letters long&lt;/p&gt;
                          &lt;!-- The user will be given a number of choices and with each wrong choice, they lose a turn --&gt;
                          &lt;p class="lives"&gt;&lt;span id="guesses"&gt;You have _ guesses remaining&lt;/span&gt;&lt;/p&gt;
                          &lt;p id="words"&gt;&lt;/p&gt;
                      &lt;/br&gt;
                          &lt;a id="play" onclick="playGame()" class="waves-effect waves-light btn-large"&gt;Spin&lt;/a&gt;
                          &lt;span id="roundsWon"&gt;Rounds won:&lt;span id="pointTotal"&gt;&lt;/span&gt;&lt;/span&gt;
                          &lt;span id="your-guess"&gt;Letter guessed&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
          
              &lt;script src="main.js"&gt;&lt;/script&gt;
          &lt;/body&gt;
          &lt;/html&gt;
          </code></pre>
  </div>
  </div>
  </p>