Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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.'
Source by futurestud.io #
 
PREVIOUS NEXT
Tagged: #js #method #string #remove #extra #spaces
ADD COMMENT
Topic
Name
3+3 =