Skip to content

Commit

Permalink
Fixed endless error
Browse files Browse the repository at this point in the history
Handled the error if user input is undefined or just an empty string (which causes an endless error)
  • Loading branch information
Keshav2567 committed Jul 5, 2021
1 parent 0cb9fd3 commit 4191c02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions random-choice-picker/script.js
Expand Up @@ -33,12 +33,14 @@ function randomSelect() {

const interval = setInterval(() => {
const randomTag = pickRandomTag()


if (randomTag !== undefined) {
highlightTag(randomTag)

setTimeout(() => {
unHighlightTag(randomTag)
}, 100)
}
}, 100);

setTimeout(() => {
Expand All @@ -64,4 +66,4 @@ function highlightTag(tag) {

function unHighlightTag(tag) {
tag.classList.remove('highlight')
}
}

0 comments on commit 4191c02

Please sign in to comment.