remove whitespace with regex javascript

JavaScript
return str.replace(/\s/g, '');
Source

Also in JavaScript: