Javascript Non-Breaking Space Using Unescape

Hello Experts -
A while back I ran across a slick technique (that I can no longer locate) to insert a non-breaking space into a javascript variable.  I recall that it involved the use of unescape and worked something like this:
var space = unescape('###');
var string = 'Hello world. ' + space + 'How are you?';

Open in new window

My objective was to render two spaces between sentences in a javascript variable.  With   rendered by javascript literally, a more creative solution is needed to get the double-spaced effect.  Can someone give me an assist with what the '###' should be above to make this work?

I know that there are ways to accomplish this using createTextNode but this technique strikes me as easier. Thanks in advance.

-- Rick
Who is Participating?
Like this?

<script language="javascript">
var space = unescape('&nbsp;&nbsp;');
var string = 'Hello world.' + space + 'How are you?';

Open in new window

It outputs HTML "Hello world.&nbsp;&nbsp;How are you?"
Which displays as "Hello world.  How are you?"
MinnRickAuthor Commented:
Thanks.  Although that wasn't what I was looking for (it was a 3-character, unicode-looking string), that works.  I also realized that I needed to write the jquery using the html() function rather than text().  Thanks for the help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.