Eliminar espacios en una cadena 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'
str = str.trim();
var str = " Hello World! ";
alert(str.trim());
let string = " Hello World! ";
console.log(string.trim().split(" ").join("_"));
//$u7@y
var puzzle1=myTrim($("#puzzleinput").val());
function myTrim(x) {
return x.replace(/^\s+|\s+$/gm,'');
}