trim space 2 side javascrip code example
Example 1: javascript remove all spaces from string
str = str.replace(/\s/g, '');
Example 2: remove space from string javascript
var str = " Hello World! ";
alert(str.trim());
str = str.replace(/\s/g, '');
var str = " Hello World! ";
alert(str.trim());