Selecting from many options with Switch Statements March 2018

Selecting from many options with Switch Statements March 2018
0.0 0

#1

Tell us what’s happening:
I have tried to solve this several times and read all the Hints that might have worked for others but I have not been able to “solve” the problem… it keeps giving me a syntax type error.

Please help

Your code so far

var answer = “”;
// Only change code below this line
switch (val){
case 1: answer=“alpha”;
break;
case 2: answer=“beta”;
break;
case 3: answer=“gamma”;
break;
case 4: answer=“delta”;
break;
default:
answer=“There is no result for “+val+”.”;
break;
}

// Only change code above this line
return answer;
}

// Change this value to test
caseInSwitch(8);```
**Your browser information:**

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

**Link to the challenge:**
https://www.freecodecamp.org/challenges/selecting-from-many-options-with-switch-statements

#2

I have also tried this to no success:

Here my solution with extra commentary:

function caseInSwitch(val) {
var answer = “”;
// Only change code below this line

switch (val) {
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);


#3

your code is correct, I’m getting errors for using “”. I changed them " " and it passed


#4

Wow thank you! this whole time the quotation marks were incorrect… man that’s what i get for copying other peoples code to help… thanks whale!