Tell us what’s happening:
I don’t really have a problem with the solution but I brought up a solution that is wrong and it is accepted as is.
Fact is that the break in this solution is unreachable because of the return value (instead of console.log).
I don’t know if I’m correct but I think this should not be marked as correct.
Your code so far
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(val){
case 1:
answer = "alpha";
return answer;
break;
case 2:
answer = "beta";
return answer;
break;
case 3:
answer = "gamma";
return answer;
break;
case 4:
answer = "delta";
return answer;
break;
default:
answer = "only 1 to 4 please";
}
// 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/64.0.3282.140 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/selecting-from-many-options-with-switch-statements