No idea what is the issue here with this piece of code

Tell us what’s happening:

Your code so far

function switchOfStuff(val) {
  var answer = "";
  // Only change code below this line
    case "a":

    case "b":
    answer= "bird";

    case "c":
   answer= "cat";

    answer= "stuff";
  // Only change code above this line  
  return answer;  

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

In your switch statement you reference the answer variable. If you look above 2 lines before that, answer has been initialized as a blank string. Should you really being using answer in your switch?

Without referencing the answer variable, many of the test cases fail so I went ahead and referenced it.

Hey you were right. I should have used the variable val in my switch instead of answer.

1 Like