Default option in Switch statements

Default option in Switch statements
0

#1

Tell us what’s happening:

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  
  
}

// Change this value to test
switchOfStuff("a");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36.

Link to the challenge:


#2

The code present when you originally started the challenge was:

function switchOfStuff(val) {
  var answer = "";
  // Only change code below this line
  
  
  // Only change code above this line  
  return answer;  
}

You deleted the return answer; line at the end of the function. If you add that return statement back into your code, you will see that your solution works fine.