Tell us what’s happening:
Describe your issue in detail here.
This is the solution in the hint and yet I am getting an “a”, “b”, and “c are not defined”. Why is this happening? The challenge Test is also asking for a “d” why would that be expected if not part of the directions?
**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";
break;
}
// Only change code above this line
return answer;
}
switchOfStuff(a);
you just have a small mistake.
remove the last break; line
the reason the test uses ‘d’ is to see if your code will give the ‘default’ answer
default is what happens for anything that is not explicitly checked by the switch
so a/b/c are all explicitly checked, d is not, so it should go to the default block
I may have duped myself. I was running a noscript plugin and had not given full permissions to FCC. The challenge was completed when i finally did so. I don’t think there’s anything wrong with the answer.