Mega Code Archive

 
Categories / JavaScript Tutorial / Statement
 

Using While loop to check user input

< html> <head> <title>Using While loop to check user input</title> <script> var correct = "AA"; var guess = ""; while (guess != correct){   guess = prompt ("Question?", "");   if (guess == correct){     alert ("Correct");   } else {     alert ("that's not it...");   } } </script> </head> <body> </body> </html>