Entfernen Sie Leerzeichen in einer Zeichenfolge JS
str.replace(/\s+/g, '')
Dangerous Duck
str.replace(/\s+/g, '')
const removeSpaces = str => str.replace(/\s/g, '');
// Example
removeSpaces('hel lo wor ld'); // 'helloworld'
var a = b = " /var/www/site/Brand new document.docx ";
console.log( a.split(' ').join('') );
console.log( b.replace( /\s/g, '') );
str = str.trim();
var str = " Some text ";
str.trim();
// str = "Some text"
var str = " Some text ";
str.trim();