Stuck on Adding a Default Option in Switch Statements

So, I’ve got the default statement working, but my switch cases for a, b and c don’t return the strings they should. I’ve set answer as described in the lesson, but it doesn’t mention returning the strings so I’m a bit confused.

function switchOfStuff(val) {
let answer = "";
// Only change code below this line
switch(answer){
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 (iPad; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/102.0 Mobile/15E148 Safari/605.1.15

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

You are switching based upon the value stored in answer

1 Like

…Blimey, that feels really obvious on second glance. Thanks for pointing that out. :sweat_smile:

We’ve all been there :slight_smile:

1 Like

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