caseInSwitch function -> no idea what's wrong

caseInSwitch function -> no idea what's wrong
0

#1

Hi!
I’m pretty stuck at the caseInSwitch function. Here’s my code:


function caseInSwitch(val) {
var answer = “”;

// Only change code below this line

switch (answer) {
case val === 1 :
answer = ‘alpha’;
break;
case val === 2:
answer = ‘beta’;
break;
case val === 3:
answer = ‘gamma’;
break;
case val === 4:
answer = ‘delta’;
break;
}

// Only change code above this line

return answer ;
}

// Change this value to test

caseInSwitch(3);


I tried writing ‘case 1:’ instead of ‘case val === 1:’ , but it still didn’t work.
Could really use some help :slight_smile:


#3

Thank you! That solved my problem :slight_smile: