Hello
I eventually got the correct answer. But I have a question: why isn’t the first case clause 0? I initially got the task wrong because I put down case 0
instead of case 1
for the first clause. I appreciate any help you guys can offer.
Your code so far
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(val) {
case 1:
return "alpha";
break;
case 2:
return "beta";
break;
case 3:
return "gamma";
break;
case 4:
return "delta";
break;
}
// Only change code above this line
return answer;
}
// Change this value to test
caseInSwitch(1);
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 11895.118.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.159 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements