Tell us what’s happening:
I have tried different “Solutions” via the forums. None of them work for me. I can get the right output for each of the variables (‘a’, ‘b’, etc), but it says that from ‘c’ on doesn’t work even though it seems to work fine. Also, I am following the way that one person said worked for them even though that is not how this site says Switch statements work: https://www.w3schools.com/js/js_switch.asp (As a side note, the w3schools answer doesn’t work either.) This is frustrating. Please help.
Your code so far
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";
}
return answer;
}
// Change this value to test
switchOfStuff('c');
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/adding-a-default-option-in-switch-statements