![Remove whitespaces from a string](https://javascriptsource.com/wp-content/uploads/2022/05/Remove-whitespaces-from-a-string-702x526.jpg)
Returns a string with whitespaces removed. Use String.prototype.replace()
with a regular expression to replace all occurrences of whitespace characters with an empty string.
const removeWhitespace = str => str.replace(/\s+/g, '');
// Example
removeWhitespace('Lorem ipsum.\n Dolor sit amet. ');
// 'Loremipsum.Dolorsitamet.'