str.replace(/\s+/g, '')
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());
str = str.trim();
var puzzle1=myTrim($("#puzzleinput").val()); function myTrim(x) { return x.replace(/^\s+|\s+$/gm,''); }
var a = b = " /var/www/site/Brand new document.docx "; console.log( a.split(' ').join('') ); console.log( b.replace( /\s/g, '') );