From 977d1de6ea426d2568c789520abb5a2be5b845ba Mon Sep 17 00:00:00 2001 From: Air Gwgie Date: Tue, 10 Sep 2024 16:17:26 -0700 Subject: [PATCH] found 3 bugs, working on the 4th --- index.html | 14 +++++++------- index.js | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index af638da..cd3ae28 100644 --- a/index.html +++ b/index.html @@ -16,21 +16,21 @@

Guessing Game

- +
-

-

You guessed too high. Try again.

-

You guessed too low. Try again.

-

+

+

You guessed too high. Try again.

+

You guessed too low. Try again.

+

You reached the max number of guesses

-

+

Congratulations, You guessed correctly!
Would you like to play again?

- + diff --git a/index.js b/index.js index 4c2a94e..ebdd886 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ const correctMessage = document.getElementById('correct'); let targetNumber; let attempts = 0; -const maxNumberOfAttempts = 5; +let maxNumberOfAttempts = 5; // Returns a random number from min (inclusive) to max (exclusive) // Usage: @@ -52,14 +52,14 @@ function checkGuess() { numberOfGuessesMessage.innerHTML = `You guessed ${guess}.
${remainingAttempts} guesses remaining`; } - if (attempts ==== maxNumberOfAttempts) { + if (attempts === maxNumberOfAttempts) { submitButton.disabled = true; guessInput.disabled = true; } guessInput.value = ''; - resetButton.style.display = ''; + resetButton.style.display = 'none'; } function hideAllMessages() { @@ -68,7 +68,7 @@ function hideAllMessages() { } } -funtion setup() { +function setup() { // Get random number targetNumber = getRandomNumber(1, 100); console.log(`target number: ${targetNumber}`); @@ -77,7 +77,7 @@ funtion setup() { maxNumberOfAttempts = 0; // Enable the input and submit button - submitButton.disabeld = false; + submitButton.disabled = false; guessInput.disabled = false; hideAllMessages();