Adding a default option in Switch statements help

Tell us what’s happening:

Your code so far

function switchOfStuff(val) {
  var answer = "";
  // Only change code below this line
  switch(val){
    case 1:
      answer="apple";
     break;
    case 2:
      answer="bird";  
     break;
    case 3:
      answer="cat";
      break;
      
    default:
      answer="stuff";
  }
  
  
  // Only change code above this line  
  return answer;  
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge:

function switchOfStuff(val) {
var answer = “”;
// Only change code below this line

switch(val){

case "a":
return "apple";
break;

case "b":
return "bird";
break;

case "c":
return "cat";
break;

default:
return "stuff";
break;

}

// Only change code above this line
return answer;
}

// Change this value to test
switchOfStuff(1);

1 Like