adding a default option in switch statements code example
Example: adding a default option in switch statements
function switchOfStuff(val) {
var answer = "";
switch(val){
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default:
answer = "stuff";
break;
}
return answer;
}
switchOfStuff(1);