remove space frm string js code example
Example 1: remove spaces in a string js
str.replace(/\s+/g, '')
Example 2: remove space from string javascript
var puzzle1=myTrim($("#puzzleinput").val());
function myTrim(x) {
return x.replace(/^\s+|\s+$/gm,'');
}