Basic JavaScript - Selecting from Many Options with Switch Statements

Tell us what’s happening:
I keep getting the “Unsyntactic break” error message when I try to run the code
Your code so far

function caseInSwitch(val) {
  let answer = "";
  // Only change code below this line
caseInSwitch1 === "alpha";
console.log("alpha");
break;
caseInSwitch2 === "beta";
console.log("beta");
break;
caseInSwitch3 === "gamma";
console.log("gamma");
break;
caseInSwitch4 === "delta";
console.log("delta");
break;
  // Only change code above this line
  return answer;
}

caseInSwitch(1);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 11; TECNO KG5k) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36

Challenge: Basic JavaScript - Selecting from Many Options with Switch Statements

Link to the challenge:

Pay attention the example of switch example provide by FCC
for further explanation for switch statement please visit:

caseInSwitch is a name function

caseInSwitch(1); means the function is called and passing value 1

Hi! Seems that you’ve forgot the switch syntax :wink:

1 Like

Thanks. It was right under my nose😄

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.