Nov 10, 2018

JavaScript Switch Statement Example

JavaScript Switch Statement


switch (myOption.value) {
case "AB":
case "BC":
case "MB":
case "NB":
case "NF":
case "NT":
case "NS":
case "NU":
case "ON":
case "PE":
case "QC":
case "SK":
case "YK":
alert("You are smart");
break;
case "N/A":
case "":
alert("Please try again");
break;
default:
alert("Hohoho");
}