remove trailing spaces regex code example
Example 1: regex to remove spaces
//..
return str.replace(/\s/g, '');
//..
Example 2: regular expression remove spaces
trim unnecessary whitespace
//..
return str.replace(/\s/g, '');
//..
trim unnecessary whitespace