javascript remove all spaces from string code example
Example 1: remove all spaces from a string javascript
.replace(/ /g,'')
Example 2: javascript remove all spaces from string
str = str.replace(/\s/g, '');
Example 3: remove space from string javascript
var str = " Hello World! ";
alert(str.trim());