The unknown syntax error

Tell us what’s happening:

  **Your code so far**

function switchOfStuff(val) {
var answer = "empty string";
// 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";
  break;
}

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

switchOfStuff(1);

console.log(switchOfstuff('a'));
  **Your browser information:**

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

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

Check your answer again - becareful of how you use colon : and semi-colon ;

1 Like

It also looks like you’ve changed the return value (right below “Only change code above this line”).

1 Like