Skip to content

Latest commit

 

History

History

10

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Remove all whitespaces

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.

Instructions

  • If the input string is empty, then return an input string.
  • Remember to account for \n and \t.

Example test cases

removeWhitespaces('Hello,   World!'); // Output: 'Hello,World!'
removeWhitespaces('  This is a sentence.\nIt contains some whitespace.  '); // Output: 'Thisisasentence.Itcontainssomewhitespace.'
removeWhitespaces('\t  \n\n'); // Output: ''