Eliminar espacios en una cadena JS
str.replace(/\s+/g, '')
Dangerous Duck
str.replace(/\s+/g, '')
str = str.replace(/\s/g, '');
const sentence = ' My string with a lot of Whitespace. '.replace(/\s+/g, ' ').trim()
// 'My string with a lot of Whitespace.'