Fixed endless error

Handled the error if user input is undefined or just an empty string (which causes an endless error)
This commit is contained in:
Keshav2567 2021-07-05 18:08:26 +05:30 committed by GitHub
parent 0cb9fd377d
commit 4191c02d62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,12 +33,14 @@ function randomSelect() {
const interval = setInterval(() => { const interval = setInterval(() => {
const randomTag = pickRandomTag() const randomTag = pickRandomTag()
if (randomTag !== undefined) {
highlightTag(randomTag) highlightTag(randomTag)
setTimeout(() => { setTimeout(() => {
unHighlightTag(randomTag) unHighlightTag(randomTag)
}, 100) }, 100)
}
}, 100); }, 100);
setTimeout(() => { setTimeout(() => {
@ -64,4 +66,4 @@ function highlightTag(tag) {
function unHighlightTag(tag) { function unHighlightTag(tag) {
tag.classList.remove('highlight') tag.classList.remove('highlight')
} }