title: How do I add a non-breaking whitespace in JavaScript without using innerHTML?
body: <p>I'm generating content dynamically and in some instances, I need to set a <code>&amp;nbsp;</code> as the only content of a <code>&lt;span&gt;</code> element.</p>
  
  <p>However, the following adds <code>&amp;nbsp;</code> as text vs adding a empty space:</p>
  
  <pre><code>var foo = document.createElement("span")
  foo = document.createTextNode("&amp;nbsp;");
  </code></pre>
  
  <p>which makes sense, so I'm wondering, how would I add <code>&amp;nbsp;</code> correctly without (!) using <code>innerHTML</code></p>
  
  <p>Thanks for help!</p>