8: unexpected identifier


#1


I'm at exercise 9 where we need to come out with our own code


it says unexpected identifier. I can't spot my mistake yet. Can someone help? thanks :slight_smile:


var answer= prompt ("what should I eat for dinner?");
switch answer {
    case 'chicken rice':
        console.log ("a bit too much");
        break;
    case 'sushi':
        console.log ("hmm a little pricey but sounds good");
        break;
    case 'noodles':
        console.log ("alright then!");
        break;
    default: 
    console.log ("ahh I'll think about it again");
}


#2

switch does require brackets, just like a if condition:

case (answer){

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.