title: Adding space in an array in JavaScript
body: <p>I am trying to make a hangman game. So I have a function that takes the word and makes a new array of the underscore dashes. I have that working perfectly but now I am trying to add the functionality of have spacing so multiply words. But now it adds random spaces instead. </p>
  
  <p>Any Help?</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>function dash(word) {
  
   var dash = [];
  
   for (var i = word.length - 1; i &gt;= 0; i--) {
  
    if (word[i] == " ") {
     dash.push("&amp;nbsp;");
    } else {
     dash.push("_"); 
    }
  
   }
  
   return dash;
  
  }</code></pre>
  </div>
  </div>
  </p>