I want to ask the user for a number, while his answer is not a number the question will keep on looping (as an alert box).
I tried to do that with while loop and isNaN
, but i'm doing something wrong.
Here is my Js:
var correct = false;
do {
var question = prompt("guess the number?");
if (question !== isNaN) {
document.write("your number is " + question);
correct = true;
break;
}
} while(! correct);