Syntax error isn't letting the code run

Tell us what’s happening:
Describe your issue in detail here.
Hello, please I need help, I have written the code for the challenge “Replacing If Else Chains with Switch” and I believe I am correct and the code isn’t even the problem the syntax is not letting the code run, and I can’t seem to figure out why. I need someone to point out the error because I can’t seem to find,m here’s the link:

Thanks.

  **Your code so far**

function chainToSwitch(val) {
let answer = "";
// Only change code below this line

  switch(val) {
 case "bob":
  answer = "Marley";
  break;
case 42:
  answer = "The Answer";
  break;
case 1:
  answer = "There is no #1";
  break;
case 99:
  answer = "Missed me by this much!";
  break;
case 7:
  answer = "Ate Nine";
  break;
// Only change code above this line
return answer;
}

chainToSwitch(7);[https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch)
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36

Challenge: Replacing If Else Chains with Switch

Link to the challenge:

You forgot the closing “}” for the switch-case.

Thank you, it fixed the problem.

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