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