Basic JS: Adding a Default Option in Switch Statements

Tell us what’s happening:
I’m not sure what is happening. The test won’t run because there is a “SyntaxError: unknown: Unexpected token (23:0)”

Line 23 is below the line where I put my code. I haven’t typed anything into that line, and it appears to be empty.

I’ve tried resetting the code and copy/pasting my code in the editor, but

Your code so far


function switchOfStuff(val) {
var answer = "";
// Only change code below this line
switch(val) {
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default:
answer = "stuff";


// Only change code above this line
return answer;
}

switchOfStuff(1);

Your browser information:

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

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

Unexpected token usually means a syntax error where you forgot something. In this case you forgot to close your switch } .

Thank you!
It’s always something like that. I wish I could proofread this code better. It’s crazy how long I spend sometimes on these tiny mistakes.

We’ve all been there. Sometimes you just need a fresh set of eyes. :slight_smile: