Hosting Solutions
mobile_logo Table of Contents


The switch statement evaluates an expression. 'case' labels establish a condition to match. The break statement can stop the switch statement from further processing if a match is found. The 'default' label is a final clause when no condition match returns a 'true' value.

var country = "USA"; switch (country) { case "UK": document.write("UK citizens are known for being drunk."); break; case "USA": document.write("USA citizens are known for being dumb."); break; default: document.write("No match for value: "+country); }



breakconstcontinuedo whileforfor inif elselabelreturnswitchtry catchvarwhilewith