Selecting Options with Switch Statements

Tell us what’s happening:
I don’t know why it shows error at each and every case. Help me out and Thanks in advance.

Your code so far

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


function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  case 1: answer = "alpha";
          break;
  case 2: answer = "beta";       
          break;
  case 3: answer = "gamma";        
          break;
  case 4: answer = "delta";
          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 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0.

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

You don’t actually have a switch-statement. :wink:

Try putting your cases inside a switch:

switch(val) {
//cases
}

Yeah alright, I did not notice that :grimacing: