title: JS - conversion of non breakable space &nbsp
body: <p>I'm reading out a text from an HTML element and saving it in an JS array, but if the user puts in more then one empty space it is converted into a non breakable space symbol. Later on if I read out the array it prints out "&amp;nbsp" instead of an empty space. How can I detect an empty space?</p>
  
  <pre><code>&amp;nbsp  //instead of an empty space
  </code></pre>
  
  <p>I tried replace, but it does not work:</p>
  
  <pre><code>myText.replace(/(&amp;nbsp;)*/g," ")
  </code></pre>