Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements

Tell us what’s happening:
Good day.
I am attempting to complete the given challenge, however, when I have finished it I get a “SyntaxError: unknown: Unexpected token (4:0)” message.
I then went to the help section and copied the given solution into my code, and the same error persists.
Any help?

Your code so far


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;
}

caseInSwitch(1);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36.

Challenge: Selecting from Many Options with Switch Statements

Link to the challenge:

You are missing your switch ().
Example:

switch(lowercaseLetter) {
  case "a":
    console.log("A");
    break;
  case "b":
    console.log("B");
    break;
}

Looks like you’re trying to use a switch statement without actually declaring one. Before jumping into the different cases you have to actually start a switch statement using the “switch” keyword. Look at the example in the challenge again.