JavaScript Remova o espaço da corda
const removeSpaces = str => str.replace(/\s/g, '');
// Example
removeSpaces('hel lo wor ld'); // 'helloworld'
Batman
const removeSpaces = str => str.replace(/\s/g, '');
// Example
removeSpaces('hel lo wor ld'); // 'helloworld'
var str = " Some text ";
str.trim();
// str = "Some text"
var str = " Hello World! ";
alert(str.trim());
var puzzle1=myTrim($("#puzzleinput").val());
function myTrim(x) {
return x.replace(/^\s+|\s+$/gm,'');
}