complete-javascript-course
complete-javascript-course copied to clipboard
05-Guess-My-Number Test Case
After successfully guessing the secret number, we can still change the guess and the game continues....
Leaving the background green (winning screen) and the score getting reduced till 0
Leading to Win and Lose at the same time
.
In my case, I personally implemented a different approach.
I hid the "Again!" button from the start (since there is no point in it being visible). Once the game finishes, I hide the "check" button, and display the "again" button in its place.
Since, the "check" button would be hidden, the player can't continue playing the game any longer (they have to click "again" to play again).
I'm guessing Jonas didn't use such an approach because he shows working with CSS classes (hiding objects etc.) later in the Modal window project. But it could be introduced in this guess my number game as well.
Kinda a bug. Jonas did implement this in the Pig game in which after reaching 100 points we couldn't click on hold or roll buttons. Thus, in this way the buy will be fixed .