javascript remove space from start and end of string code example
Example 1: js remove space from string
string.split(" ").join("")
Example 2: how to remove spaces from strings javascript
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );
Example 3: javascript remove spaces at the beginning of the end of the string
const stringWithSpaces = ' I learn JS with Coderslang every day ';
console.log(stringWithSpaces.trimStart());
console.log(stringWithSpaces.trimEnd());
console.log(stringWithSpaces.trim());
Example 4: delete space from string javascript
var str = "470 ";
str.trim();