trim white spaces in js code example
Example 1: remove spaces in a string js
str.replace(/\s+/g, '')
Example 2: replace white spaces javascript
const name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio
str.replace(/\s+/g, '')
const name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio