SyntaxError: Unexpected token case


#1

The code below gives me this error,:
SyntaxError: Unexpected token case.

what does it mean?

var getReview = function (movie) {
    
    switch(movie){
        
        case "Toy Story 2":
            return "Great story. Mean prospector.",
        
        case "Finding Nemo":
            return "Cool animation, and funny turtles.",
        
        case "The Lion King":
            return "Great songs.",
        
        default:
            return "I don't know!";
    }

};
getReview("Toy Story 2");

#2

in several cases you have a , after you return a string, why?


#3

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