mercredi 24 mars 2021

Submit empty field returns ''NaN is not correct, 2 guesses left'' (number guesser game)

My Validation is not working as i want it to when click submit with an empty field. Instead of displaying the message ''Please enter a number between 1 and 10, it shows the message ''NaN is not correct, 2 guesses left''

Any help would be much appreciated!

/ Listen for guess guessBtn.addEventListener('click', function(){ let guess = parseInt(guessInput.value);enter code here

// Validate input if (isNaN(guess) || guess < min || guess > menter code hereax){ setMessage(Please enter a number between ${min} and ${max}, 'red'); }

Aucun commentaire:

Enregistrer un commentaire