js method string remove extra spaces
str.replace(/\s+/g, '')const sentence = ' My string with a lot of Whitespace. '.replace(/\s+/g, ' ').trim()
// 'My string with a lot of Whitespace.'
str = str.replace(/\s/g, '');
Also in JavaScript:
- how to make a discord bot
- object object javascript
- how to add json data to xmlhttprequest
- jquery watch checkbox change
- wait javascript
- how to get value of input in javascript
- javascript set html select value
- how to print an array javascript
- javascript genreate number id
- reactnode prop-types
- javascript print object pretty
- FizzBuzz
- moment js date between two dates
- Error: Can't resolve 'fs' webpack
- how to know how many pixels of page be scrolled javascript
- how to export fs.readFile
- javascript linting
- jquery modify style attribute
- javascript toggle variable
- jquery is not defined rails
- js shortcut
- how to put firebase config in a sperate file react native
- expressjs create encrypted password
- javascript full screen div