Skip to content

Commit

Permalink
Added codes to clear and focus the input field after alert
Browse files Browse the repository at this point in the history
  • Loading branch information
KodeIva committed Jan 18, 2024
1 parent 83005fc commit fa99783
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ function playGame() {
alert('Please enter a number between 1 and 100')
} else if(userGuess=== '' || isNaN(userGuess)) {
alert('Enter only NUMBERS!!!')
input.value = ''
input.focus()
}else if (userGuess < compGuess) {
numberOfGuesses += 1
guessedNumbers.push(userGuess)
Expand Down

0 comments on commit fa99783

Please sign in to comment.