Menu

gitpiper

removeWhitespace javascript Code Snippet in 2022

stringregexpbeginner

Last Updated: 26 November 2022

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, '');
removeWhitespace('Lorem ipsum.\n Dolor sit amet. '); // 'Loremipsum.Dolorsitamet.'

javascript snippet similar to removeWhitespace For You in November 2022

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2022 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️