const removeAllSpaces = (string) => { const newText = string.replace(/s+/g, ""); return newText }; console.log(removeAllSpaces(" Hello World ")); //HelloWorld