var userInput = false;
function promptUser(){
return prompt("Enter Value");
}
while(!userInput){
var value = promptUser().toLowerCase();
if(value.indexOf("yes") != -1){
userInput = true;
console.log("Yes ! Call funtion to proceed furthur.");
}else if(value.indexOf("no") != -1){
userInput = true;
console.log("No ! Exiting program.");
}
}
It will keep on asking for values until either a Yes or No is provided as input anywhere in the string.