diff --git a/index.html b/index.html index af638da..0cee741 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + diff --git a/index.js b/index.js index 4c2a94e..1427f1c 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ function checkGuess() { numberOfGuessesMessage.innerHTML = `You guessed ${guess}.
${remainingAttempts} guesses remaining`; } - if (attempts ==== maxNumberOfAttempts) { + if (attempts === maxNumberOfAttempts) { submitButton.disabled = true; guessInput.disabled = true; } @@ -63,7 +63,7 @@ function checkGuess() { } function hideAllMessages() { - for (let elementIndex = 0; elementIndex <= messages.length; elementIndex++) { + for (let elementIndex = 0; elementIndex < messages.length; elementIndex++) { messages[elementIndex].style.display = 'none'; } } @@ -74,7 +74,7 @@ funtion setup() { console.log(`target number: ${targetNumber}`); // Reset number of attempts - maxNumberOfAttempts = 0; + const maxNumberOfAttempts = 0; // Enable the input and submit button submitButton.disabeld = false;