GitHub 6219★

Remove spaces from a string

JavaScript version

const removeSpaces = (str) => str.replace(/\s/g, '');

TypeScript version

const removeSpaces = (str: string): string => str.replace(/\s/g, '');

Examples

removeSpaces('hel lo wor ld'); // 'helloworld'
Follow me on and to get more useful contents.