In this coding challenge, you will be implementing a function called removeWhitespaces(string)
that takes a string
as the input. The function should return the string with all the whitespace removed.
- If the input string is empty, then return an input string.
- Remember to account for
\n
and\t
.
removeWhitespaces('Hello, World!'); // Output: 'Hello,World!'
removeWhitespaces(' This is a sentence.\nIt contains some whitespace. '); // Output: 'Thisisasentence.Itcontainssomewhitespace.'
removeWhitespaces('\t \n\n'); // Output: ''