JavaScript Удалить все пробелы
var spacesString= "Do I have spaces?";
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
Grepper
var spacesString= "Do I have spaces?";
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
const removeSpaces = str => str.replace(/\s/g, '');
// Example
removeSpaces('hel lo wor ld'); // 'helloworld'
var str = " Some text ";
str.trim();
var str = " Hello World! ";
alert(str.trim());
"hello world".replace(/\s/g, "");
const str3 = " Hellow World! "
const str3Res = str3.trim() //"Hellow World!"