Tell us what’s happening:
OK I’m really really frustrated right now. I’ve looked at a half dozen forum threads trying to get this to work and nothing is working. It looks exactly like an answer I found on one of the threads but it only returns “a is not defined”. Help please.
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";
}
// Only change code above this line
return answer;
}
// Change this value to test
switchOfStuff(a);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements