I am a beginner at javascript and I have been searching everywhere for an answer on how to validate user input from a prompt to ensure the correct number is entered. I've tried result!==isNan()
, result==isNan(Nan)
, and various other variations. Can someone please explain why this isn't working and provide guidance on how to make it work?
var result = prompt("Enter a number between 4-10");
while (result<4 || result>10 || result==isNaN(result)) {
var result = prompt("Please enter a number between 4-10!");
}
alert ("Success")