Selecting from many options with Switch Statements (Not understood)

Selecting from many options with Switch Statements (Not understood)
0

#1

Tell us what’s happening:

Your code so far

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

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

Your browser information:

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

Link to the challenge:


#2

since you are using val as the switching case, you want to make sure that answer is changed depending on what val is. so looking at the input in this case, val would be 1. When val is 1, answer should be alpha, and so on with the values and answers on the left sidebar of the problem.


#3

Ya. I got the solution.

Actually, I didn’t saw the variable answer.
That’s why I didn’t understand, how to make the value equal.

When I posted this question, after 30 minutes. I noticed the variable answer :rofl:

Sorry, for posting this silly question.