Today I finished implement the JavaScript code. I ended up adding two conditionals for check if the game reached five rounds.
Then tested the code and it worked like expected.
I added in a window.confirm() method to prompt the user to play again once the game is over, but the I noticed there's a slight bug when the game reaches round 5.
The round count would reach five, but then the confirm window would pop up before the DOM elements would update which is weird because I'm not calling the gameOver function until at least the round count equals five.
It might be because the roundNumber updates to five at the start of the function and the gameOver conditional is executing faster than the DOM elements. I need to spend some time thinking this through again.
Top comments (0)