diff --git a/main.js b/main.js index 2f903b3..0957f53 100644 --- a/main.js +++ b/main.js @@ -10,12 +10,15 @@ const checkMatched = () => { } } async function lol() { - this.classList.add('active') - const activeCards = document.querySelectorAll('.active') - - await delay(500) + let activeCards = document.querySelectorAll('.active') + if (activeCards.length < 2) { + this.classList.add('active') + activeCards = document.querySelectorAll('.active') + await delay(500) + } if (activeCards.length === 2) { + if (activeCards[0].classList[1] === activeCards[1].classList[1]) { console.log("Great!") activeCards[0].classList.add('matched')