str.replace(/\s+/g, '')
.replace(/ /g,'')
var str = " Some text "; str.trim(); // str = "Some text"
string.split(" ").join("")
const removeSpaces = str => str.replace(/\s/g, ''); // Example removeSpaces('hel lo wor ld'); // 'helloworld'
str = str.replace(/\s/g, '');
var str = " Hello World! "; alert(str.trim());
newString = string.replace(/\s+/g,' ').trim();
var str = '/var/www/site/Brand new document.docx'; document.write( str.replace(/\s/g, '') );