All on your own SyntaxError: Unexpected identifier


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-qDwp0/1/4?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: Unexpected identifier


var condition = prompt ("how are you?","write your answer");
switch (condition){
case 'fine' :
    console.log("oh i am also fine!");
    break;
case 'good' :
    console.log("nice");
    break;
case 'tired' :
    console.log("go sleep now!");
    break;
default
    console.log("i didn't understand");
}


#2

You're missing your colon here:


#3

even after semi colon i am getting error

SyntaxError: Unexpected token }


#4

You also need break; before the last curly brace to end your code.


#5

@bayoishola20 said colon (:) after default, not semi colon(;).
like this:

//rest of your code above
default:
    console.log("blah blah");
}; //<== this it so end the function

#6

worked guys thank you!


#7

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