Using While loop to check user input : while : Statement JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Statement » while »

 

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Statement
» while