remove space after string in js code example
Example 1: remove extra space in string javascript
newString = string.replace(/\s+/g,' ').trim();
Example 2: remove space from string javascript
var str = " Hello World! ";
alert(str.trim());