Tell us what’s happening:
Your code so far
function caseInSwitch(val) {
var answer = “”;
// Only change code below this line
switch (val) {
case 1:
if(val === 1){ answer = “alpha”; return answer; }
break;
case 2:
if(val === 2){ answer = “beta”; return answer; }
break;
case 3:
if(val === 3){ answer = “gamma”; return answer; }
break;
case 4:
if(val === 4){ answer = “delta”; return answer; }
break;
}
// Only change code above this line
}
// Change this value to test
caseInSwitch(1);
I have been working on this code for well over an hour. I resorted to even copying and pasting answers that were given in the ‘hints’ section that were confirmed as correct. Yet, nothing worked for me. I refreshed my page and tried numerous things out of desperation. I need help.
Your browser information: Chrome
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
.
Challenge: Selecting from Many Options with Switch Statements
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements