JavaScript Switch
The switch statement is used for fielding multiple values for a single input variable. Each answer, or case, is given its own block of code. Incorrect answers, or answers that do not have their own block of code, go directly to default. Here is the template:var answer = prompt("How do you answer this question?"); switch(answer) { case "yes": //The block of code that is set in motion by //the above answer ("yes") is entered here: return("Stay with the affirmative"); break; case "no": return("Dour Dan"); //Be sure to add "break" after each case's block of code, //or else the program will continue down this loop: break; case "maybe": return("The indeterminate answer!"); break; default: //If a match is not found, the program default to //the block of code in default... console.log("Please enter an answer"); }