JavaScript entfernen Sie alle Räume von der Zeichenfolge
str = str.replace(/\s/g, '');
TC5550
str = str.replace(/\s/g, '');
var spacesString= "Do I have spaces?";
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
var name = "codepadding code ";
// remove all white spaces single or multiple spaces
var name = name.replace(/\s/g, '');
console.log(name)
//output
//mizanurrahmanmizan
value = value.trim();
console.log(' a b c d e f g '.replaceAll(' ',''));
//abcdefg
var string = " Hello World! "
console.log(string);
//" Hello World! "
string2 = string.trim();
console.log(string2);
//"Hello World!"