I\'ve read this question about javascript trim, with a regex answer.
Then I expect trim to remove the inner space between Hello and World.
For space-character removal use
"hello world".replace(/\s/g, "");
for all white space use the suggestion by Rocket in the comments below!