xxxxxxxxxx
"hello world".replace(/\s/g, "");
xxxxxxxxxx
const str = "Hello, World! ";
const removedWhiteSpace = str.replace(/\s/g, "");
console.log(removedWhiteSpace); // Output: "Hello,World!"
xxxxxxxxxx
const str = " remove whitespace from string ";
const result = str.replace(/\s/g, "");
console.log(result);
xxxxxxxxxx
const str3 = " Hellow World! "
const str3Res = str3.trim() //"Hellow World!"