DEV Community

Jennifer Tieu
Jennifer Tieu

Posted on

Self-Taught Developer Journal, Day 54: TOP Building Rock Paper Scissors UI cont.

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.

Round Condition

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

The Odin Project
Revisiting Rock Paper Scissors

Top comments (0)