remove spaces from a string es6 code example Example: remove spaces in a string js str.replace(/\s+/g, '')