str.replace(/\s+/g, '')
.replace(/ /g,'')
str = str.replace(/\s/g, '');
string.split(" ").join("")
str = str.trim();
var str = '/var/www/site/Brand new document.docx'; document.write( str.replace(/\s/g, '') );
var a = b = " /var/www/site/Brand new document.docx "; console.log( a.split(' ').join('') ); console.log( b.replace( /\s/g, '') );