Error in your code/instructions

UI returns an error when the code is correct for challenge “Adding A Default Option in Switch Statements”.
“ReferenceError: a is not defined” occurs because code reads
switchOfStuff(a) when it should read switchOfStuff(“a”) in order to work.

  **Your code so far**
function switchOfStuff(val) {
let answer = "";
// Only change code below this line
switch (val) {
case "a":
  answer = "apple";
case "b":
  answer = "bird";
case "c":
  answer = "cat";
  answer = "stuff";
// Only change code above this line
return answer;


Should read switchOfStuff(“a”);

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

You haven’t defined a variable named a so you can’t use the variable a in that function call. But you can pass in the string “a”.

1 Like

Thank you - that’s fine - but your UI instructs the user not to make any changes below a particular comment. I had to make changes below the comment (add inverted commas around the a) to get my code to pass.
Remember you’re dealing with novices here - we don’t understand what we’re doing, but we are told to trust your instructions, but in this case it was necessary to ignore your instructions to pass your test.

Not sure what you are talking about. You do not have to change anything below the comments to get a working solution. The function is all that is checked.

You can make changes below the function itself but the tests only make calls to the function.

Also, not sure what you mean but inverted commas around the a to get your code to pass. Would you mind sharing the full code you use to finally get the code to pass?

1 Like

You changed that line from what you were given


It really was not.