javascript how to use switch statements code example
Example 1: Javascript switch case code format
switch(type) {
case "SomeString":
// Functionality
break;
case "OtherString":
// Functionality
break;
default:
// Functionality
break;
}
Example 2: multiple case switch javascript
switch (varName)
{
case "afshin":
case "saeed":
case "larry":
alert('Hey');
break;
default:
alert('Default case');
}