remove all whitespace from string javascript code example
Example 1: javascript remove all whitespaces
var spacesString= "Do I have spaces?";
var noSpacesString= myString.replace(/ /g,'');
Example 2: remove all spaces from a string javascript
.replace(/ /g,'')
Example 3: javascript remove all spaces from string
str = str.replace(/\s/g, '');
Example 4: delete backspace on string js
var str1 = 'Hello world xd lol'
var str2 = ''
str2 = str1.replace(/\s/g, '')
console.log(str2)
Example 5: remove whitespace javascript
var str = " Some text ";
str.trim();