1var spacesString= "Do I have spaces?";
2var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
1var string = " Hello World! "
2console.log(string);
3//" Hello World! "
4string2 = string.trim();
5console.log(string2);
6//"Hello World!"
1var string = "Javascript is fun";
2var newString = string.replace(" ", "_");
3console.log(newString); // Javascript_is_fun