Remove whitespaces inside a string in javascript

后端 未结 4 1154
[愿得一人]
[愿得一人] 2020-11-29 00:22

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.



        
4条回答
  •  醉话见心
    2020-11-29 00:29

    For space-character removal use

    "hello world".replace(/\s/g, "");
    

    for all white space use the suggestion by Rocket in the comments below!

提交回复
热议问题