switch syntaxs JS code example
Example 1: Javascript switch case code format
switch(type) {
case "SomeString":
// Functionality
break;
case "OtherString":
// Functionality
break;
default:
// Functionality
break;
}
Example 2: switch javascript
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}