I’m doing the JS tutorials, and I’ve got to the “Selecting from many options with Switch Statements”.
I have the code below, but it’s returning “SyntaxError: Unexpected token case
”.
It is also doing the same with a CodePen, but I’m not sure what I’m doing wrong.
https://codepen.io/n8udd/pen/odqoJL?editors=1111
The wiki for this tutorial is less than useless, as it just copies the challenge.
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
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;
}