Switch Statements please give me solution for it any one

Switch Statements please give me solution for it any one
0.0 0

#1

Tell us what’s happening:

Your code so far


function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  
  
  
  // 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 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0.

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


#2

What’s the issue? What’s the task to be done?


#3

check the link to the challenge
given in above comment


#4
Spoiler
 switch(val) {
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;
}

Hope this helps, reach out if you need pointers on how it works.


#5

All the information you need is provided in the example text on the left.

If someone just gives you the answer you wont learn anything!

At least give it a shot, and if you get stuck post the code you have so that the rest of us can give you hints


#6

Your code should be like:

  var answer = "";
  // Only change code below this line
    switch(val){
      case 1:
      answer = "alpha";
      break;

      case 2:
      answer = "beta";
      break;
    }
  
  
  // Only change code above this line  
  return answer;  
}

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

#7

Well there goes that then :joy:

Spoiler tags?


#8

All fixed! :sunglasses: and topic closed!!!


#9

oppsie…not sure how to add a tag. I collapsed the answer.


#10

Thank you all :roll_eyes: