How would I remove blank characters from a string in JavaScript?

前端 未结 3 1061
别那么骄傲
别那么骄傲 2021-02-13 01:51

How would I remove blank characters from a string in JavaScript?

A trim is very easy, but I don\'t know how to remove them from inside the string. For example:<

3条回答
  •  Happy的楠姐
    2021-02-13 02:45

    You can also do this without a regular expression or a replace-

    var string= string.split(' ').join('');
    

提交回复
热议问题