Add /g to replace multiple spaces.
This commit is contained in:
@@ -22,7 +22,7 @@ function expand(words, text) {
|
||||
const word = wordsWithLetter[Math.floor(Math.random() * wordsWithLetter.length)];
|
||||
return word;
|
||||
|
||||
}).reduce((acc, cur) => acc + " " + cur).replace(/\s{2,}/, " ");
|
||||
}).reduce((acc, cur) => acc + " " + cur).replace(/\s{2,}/g, " ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user