The best way to add white space to use a unicode literal for a non-breaking space. Instead of specifying non-breaking space with
we can instead use
This ensures that the non-breaking space is evaluated correctly when the markup is being rendered.
So a blank string:
Is usually replace with:
However, this won’t get rendered using
document.write so in that situation replace
For other space-related Unicode literals there a multitude of options:
\x20– standard space or
\xC2\xA0– non-breaking space or
\x0D– return or
\x0A– a newline or
\x09– a tab or
And there you have it, there’s is a strange amount of depth to for creating whitespace.