const removeSpaces = str => str.replace(/s/g, '');
// Example
removeSpaces('hel lo wor ld'); // 'helloworld'
str.replaceAll(/s/g,'')
.replace(/ /g,'')
var str = " Hello World! ";
alert(str.trim());
const greeting = ' Hello world! ';
console.log(greeting);
// expected output: " Hello world! ";
console.log(greeting.trim());
//your boy siddhesh Kuakde
let text = "I love you"
text = text.replace( / +/g, '_') // replace with underscore ('_')
console.log(text) // I_love_you
var puzzle1=myTrim($("#puzzleinput").val());
function myTrim(x) {
return x.replace(/^s+|s+$/gm,'');
}