scrimba
Learn Basic JavaScript
Adding a Default Option in Switch Statements
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Adding a Default Option in Switch Statements
AboutCommentsNotes
Adding a Default Option in Switch Statements
Expand for more info
index.js
run
preview
console
function switchOfStuff(val) {
var answer = "";
switch (val) {
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
}
return answer;
}

// Change this value to test
console.log(switchOfStuff("a"));
Console
index.html
-1:33