How to use prompt repeatedly till we get a valid input


//here in this code if I give wrong input again after the prompt, it just continues

var answer = prompt("Add your question here!");

switch(answer) {
case "what's an apple":
console.log("its a fruit ...u idiot");

case "what's an aeroplane":
console.log("bro are you high?");

// Add your code here!
console.log("we don't answer that");
prompt("ask again");


have loops already been covered? You can use do while loop


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.