So I'm making a browser based game. I want it to display a prompt which will only move on to the next bit of code if a correct answer is inputted. However despite a correct answer the prompt displays, stuck in an infinite loop.
Here is the code.
do {
var cavalry = prompt("Now you need to deploy your troops. They wait for your command. First how shall you deploy your cavalry? -all left -all right -split evenly -stronger left -stronger right").toLowerCase();
switch(cavalry) {
case 'all left':
console.log("Your chose all left.");
break;
case 'all right':
console.log("You chose all right.");
break;
case 'split evenly':
console.log("You chose split evenly.");
break;
case 'stronger left':
console.log("You chose stronger left.");
break;
case 'stronger right':
console.log("You chose stronger right.");
break;
default:
alert("That is not an option");
console.log("Please choose one of the options.");
break;
}
}
while (cavalry!="all right" || cavalry!="all left" || cavalry!="stronger left" || cavalry!="stronger right" || cavalry!="split evenly");