Self-Taught Developer Journal, Day 54: TOP Building Rock Paper Scissors UI cont.
Jennifer Tieu
Posted on February 5, 2022
Today I am still working on my JavaScript code.
I am trying to set up tracking the rounds. The game should stop when the round count reaches five. At first, I was putting a conditional to check the round count first when the button was pressed, but I realized an issue.
Assuming the round count is four, when the player presses the button and the condition where round equals five will not execute. However, when they round finishes then the round will update to five and they game should end. I could put the same condition at the end, but I don't really want to repeat myself in two places. I could try making a function or a loop? Maybe not a loop. A function might work.
I might try that and see.
Resources
Posted on February 5, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
February 15, 2022