while
loop to a programBelow you will find a program that needs a conditional loop before it can that let you tell a "Knock, knock" joke.
Enter and run the program. You will need to add a
while
loop that makes sure that the reply is Orange.
Inside the loop you need to repeat the alert
and
prompt
statementis.
<html>
<body>
<script type="text/javascript">
const knock = "Knock, Knock!"
var reply;
alert(knock);
reply = prompt("Who's there?", "");
//the while loop goes here
alert("Orange you glad I didn\'t say \"banana\" again?");
</script>
</body>
</html>