Удалить пространства в струне JS
str.replace(/\s+/g, '')
Dangerous Duck
str.replace(/\s+/g, '')
str = str.trim();
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );
str.replace(/\s+/g, '') //Replace str with variable name you have string saved too.
var str = "470 ";
str.trim();