//.. return str.replace(/s/g, ''); //..
s is the regex character for whitespace. It matches spaces, new lines, carriage returns, and tabs.
trim unnecessary whitespace