remove all spaces from a string javascript
snippet in javascript

javascript remove all whitespaces

user2709

var spacesString= "Do I have spaces?"; 
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"

remove all spaces from a string javascript

user2756

.replace(/ /g,'')

how to remove spaces in javascript

user1150

string.split(" ").join("")

remove space from string javascript

user9504

var str = "       Hello World!        ";
alert(str.trim());