Skip to content

Commit 900acfe

Browse files
committed
made sure new words dont include spaces
1 parent 0c16795 commit 900acfe

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

public/js/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ function buildSentences() {
163163
function addWord() {
164164
let language = words[config.language]
165165
let randomWord = language[Math.floor(Math.random() * language.length)];
166+
while (randomWord.indexOf(' ') > -1) {
167+
randomWord = language[Math.floor(Math.random() * language.length)];
168+
}
166169
wordsList.push(randomWord);
167170
let w = "<div class='word'>";
168171
for (let c = 0; c < randomWord.length; c++) {

0 commit comments

Comments
 (0)