I want the computer to wait a few seconds before taking its turn
Post any code you think might be relevant (one fenced block per file)
let playerTurn = true
const matchCheck = (event) => {
console.log('in matchCheck, event.target.id',event.target.id)
let selection = event.target.id
console.log('matchCheck, choices', choices)
if (selection === 'faceCard1') {
result = document.getElementById("results").innerText='Congratulations, You Win! Press the button to play again.';
removeHandler()
// need to stop game
} else {
console.log('got here')
playerTurn = false
console.log(playerTurn)
result = document.getElementById("results").innerText='Sorry, no match. It is the computers turn.';
}
console.log('in matchCheck, result',result)
// remove the card choice from the array for computers turn
choices.splice(choices.indexOf(selection),1)
console.log(choices)
if (playerTurn === false) {
setTimeout(computerChooses(),100000)
clearTimeout()
computerChoice()
}
}
function removeHandler() {
document.getElementById('faceCard1').removeEventListener('click', matchCheck);
document.getElementById('faceCard2').removeEventListener('click', matchCheck);
document.getElementById('faceCard3').removeEventListener('click', matchCheck);
}
const myTimeout = setTimeout(computerChooses, 10000);
function stopWait() {
clearTimeout(myTimeout);
}```
stopWait()
### If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
no error messages
### What is your best guess as to the source of the problem?
The syntax is wrong or I am putting it in the wrong function
### What things have you already tried to solve the problem?
I created its own function to call it, I put on the functions when they are executed
### Paste a link to your repository here[
](https://github.com/melsil11/Find-the-Puppy)
What's the problem you're trying to solve?
I want the computer to wait a few seconds before taking its turn
Post any code you think might be relevant (one fenced block per file)