After taking 3 months off from learning JavaScript as part of the FreeCodeCamp front end development certification program, work finally slowed down to tackle some exercises during lunch. The topic was “Multiple Identical Options in Switch Statements”. While I successfully added a case statement for each number in the range, I made a simple rookie mistake.
I jumped right in by creating all of the cases and break statements, making sure to add the semicolons where appropriate. Before adding “switch(val) {“ to start the switch statement, added that then ran the tests.
The error I got was “SyntaxError: Unexpected end of input”. I googled the syntax for a switch statement and read through the documentation on StackOverflow. Then a lightbulb lit up in my head to check if the code had closing curly braces to match the starting curly braces. You’ll see in the screenshots, how I fixed the problem to successfully execute the switch statement.
Make sure your functions have matching closing curly braces.
some(code) {
return “Did you check for closing curly braces?”;
}
SyntaxError: Unexpected end of input
Solution: Check the code to make sure all curly braces have a matching closing curly brace.

Turns out I forgot to close the switch statement, you’ll see the missing curly brace below.

Successful execution of switch statement with the multiple versions of the same option.