how i can remove a space from 2 words in a string javascript code example
Example 1: javascript remove space from two side of string
const string = " this contains spaces ";
string.replace(/\s{2,}/g, '').trim()
Example 2: Delete spaces in text in javascript
var a = b = " /var/www/site/Brand new document.docx ";
console.log( a.split(' ').join('') );
console.log( b.replace( /\s/g, '') );