made sure new words dont include spaces

This commit is contained in:
Jack 2020-05-16 17:57:42 +01:00
parent 0c16795b02
commit 900acfe27f

View file

@ -163,6 +163,9 @@ function buildSentences() {
function addWord() {
let language = words[config.language]
let randomWord = language[Math.floor(Math.random() * language.length)];
while (randomWord.indexOf(' ') > -1) {
randomWord = language[Math.floor(Math.random() * language.length)];
}
wordsList.push(randomWord);
let w = "<div class='word'>";
for (let c = 0; c < randomWord.length; c++) {