Switch Statements please give me solution for it any one

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

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

check the link to the challenge
given in above comment

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.

1 Like

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

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);

Well there goes that then :joy:

Spoiler tags?

1 Like

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

1 Like

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

1 Like

Thank you all :roll_eyes:

1 Like