Basic JS : Adding a Default Option in Switch Statements

Tell us what’s happening:
Describe your issue in detail here.
My code is not working. But I think I’ve done it right way.

  **Your code so far**

function switchOfStuff(val) {
var 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";
  break;
}


// Only change code above this line
return answer;
}
switchOfStuff("a");
switchOfStuff("b");
switchOfStuff("c");
switchOfStuff("d");
switchOfStuff(4);
  **Your browser information:**

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

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

do you see this error in the console and the squiggly red line in the editor?

image

Try to solve it

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.