replace white spaces javascript
snippet in javascript

replace white spaces javascript

user3852

const name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio

js replace all spaces

user7411

var replaced = str.replace(/ /g, '_');