SyntaxError in Basic JavaScript - Unable to fix

Hello team!

I’m looking for help regarding the below error.

My function is properly closed, so is the variable. And yet, the system keeps pointing at the “c” from the first case as an issue.
I’ve tried removing the space lines and space tabs, as well as changing the variable’s syntax at the end for “:”, however, there’s been no change in the error.

I’ve also googled this issue, but it doesn’t seem to match anyone’s else error.
Any other similar error points out the missing or incorrect syntax. Mine doesn’t.

I apologize if I’m wasting your time. I’ve checked multiple times and can’t seem to find the issue in my syntax. Thank you for the help!

SyntaxError: unknown: Unexpected token (5:2)

  3 |   // Only change code below this line
  4 |
> 5 |   case "a":
    |   ^
  6 |     answer = "apple";
  7 |     break;
  8 |   case "b":
  **My code so far**
function switchOfStuff(val) {
let answer = "";
// Only change code below this line

case "a":
  answer = "apple";
case "b":
  answer = "bird";
case "c":
  answer = "cat";
  answer = stuff;

// Only change code above this line
return answer;

  **Your browser information:**

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

Challenge: Basic JavaScript - Adding a Default Option in Switch Statements

Link to the challenge:

I do not see a switch statement. Look at the example code for the syntax.

1 Like

Hi Randell,
You’re totally right! I can’t believe I missed such a big part of the code…
Thanks for the quick help!

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