Switch doesn't work

Switch doesn't work
0.0 0

#1

Tell us what’s happening:

Your code so far


function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch(answer){
 case 1:
 "alpha";
 break;
 case 2:
"beta";
 break;
 case 3:
"gamma";
 break;
 case 4:
"delta";
 break;
 default:
 break;
  }
  
  
  // Only change code above this line  
  return answer;  
}

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

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements


#2

The switch is working fine. The problem is you are just have a string on each line after the case line. Since your return statement returns the answer variable and you want it to return those values you wrote, what should you do so answer has the correct value when the return statement executes?


#3

switch(val){//not “answer”
case 1:
answer=“something”;
break;
}


#4

case 1:
answer = “alpha”;
break;
case 2:
answer = “beta”;
break
etc…
I had the same issue earlier. It stump me for a bit also.