Help! Video answer same but not pass

Tell us what’s happening:

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";
break;
}
// Only change code above this line
return answer;
}

switchOfStuff(a);

Your browser information:

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

Challenge: Adding a Default Option in Switch Statements

Link to the challenge:

this is a syntax error

2 Likes

Can you pls explain? i dont understand.

how do you assign a value to a variable?
you did it in various other places in this code

So u mean I hav to check out all previous answer to make JS consistent execute? is that mean? A dumb beginner here…

in this exact code you posted there are four correct assignments of a value to a variable

and then there is this syntax error that you need to fix:

how do you assign a value to a variable?

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;
case “d”:
answer = “stuff”;
break;
case “value”:
answer = “stuff”;
break;
default:
answer= “stuff”;
break;
}
// Only change code above this line
return answer;
}

switchOfStuff(“4”);

Finally passed it. Omg spend too much time here. Thank for helping :smile: