Adding a Default Option in Switch Statements :

Tell us what’s happening:
Describe your issue in detail here.
My code isn’t working :cry:
Send me some help :hugs:

   **Your code so far**

function switchOfStuff(val) {
 let answer = "";
 // Only change code below this line
switch (val) {
  case "a":
   answer = "apple";
   break;
  case "b":
   answer = "bird";
   break;
  case "c":
   answer = "cat";
   break;
...
  default:
   answer = "stuff";    
}
 // Only change code above this line
 return answer;
}

switchOfStuff(1);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

hmm, what is this doing here?

Careful of the ....

Remember that default cases directly follow the cases above them.

Happy coding!

1 Like