regex to remove spaces characters javascript code example
Example 1: remove whitespace with regex javascript
return str.replace(/\s/g, '');
Example 2: js remove spaces
str = str.trim();
return str.replace(/\s/g, '');
str = str.trim();