Replacing multiple empty spaces
<pre><code>var firefoxIngs = myText.replace(/ /g,"&amp;nbsp;");
</code></pre>

<p>This is my string: </p>

<pre><code>"h  a"//it has two empty spaces between h and a
</code></pre>

<p>After the code it becomes: </p>

<pre><code>"h&amp;nbsp;a"//it has one empty spaces between h and a
</code></pre>

<p>I want it to be </p>

<pre><code>"h&amp;nbsp;&amp;nbsp;a"
</code></pre>

<p>Why is this happening and how to fix it?</p>
