remove left and right space in javascript code example
Example 1: how to remove spaces from strings javascript
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );
Example 2: javascript remove first space in string
//use trim() on your string. It removes first and last whitepsaces
let str = " aa bb ";
console.log(str.trim()); // "aa bb"