Answers for "remove extra whitespace js"

4

js method string remove extra spaces

const sentence = '    My string with a    lot   of Whitespace.  '.replace(/\s+/g, ' ').trim()

// 'My string with a lot of Whitespace.'
Posted by: Guest on January-04-2021
18

javascript remove all whitespaces

var spacesString= "Do I have spaces?"; 
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
Posted by: Guest on August-01-2019

Code answers related to "remove extra whitespace js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language