"Selecting from Many Options with Switch Statements "

"Selecting from Many Options with Switch Statements "
0

#1

I don’t know what I am doing wrong. If anybody can point out the mistakes, I would appreciate it.


function caseInSwitch(val) {
  var answer = "val";
  // Only change code below this line
  switch(val) {
    case "1":
      "alpha";
      break;
    case "2":
      "beta";
      break;
    case "3":
      "gamma";
      break;
    case "4":
      "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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 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
      "alpha";

The lines like this are not JavaScript commands. They don’t do anything. You are always returning “val” because that is what answer is set to and you return answer.

Also, numbers are different from strings so 1 is not the same as "1".


#3

So should I write just 1 instead of “1”?
Also, instead of writing “alpha”, what would the correct thing to write be?


#4

Never mind I understand now. Thank You!