#4. I have to celebrate you baby


#1


SyntaxError: Unexpected token return
What should I do ? :cry:

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


#2

This line should be outside of the function body.

var getReview = function (movie) {
    // code
};

var movie = prompt ("Review : Toy Story 2 , Finding Nemo or The Lion King ? ");
getReview(movie);

#3

I fixed it but it still showed " Unexpected token return" :cry:

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


#4

Missing colon : after case parameter.

You should also know that break is unreachable after return so those can all be removed. We only use break when not using return in a switch atatement.


#5

Thank you :blush: it worked


#6

Hi i tried the same thing but it says check the review for toy story 2 please help :confused:
var movie = prompt ("Review : Toy Story 2 , Finding Nemo or The Lion King ? ");
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(movie);


#7

Hi you didn't put the break to your case

case "1":
   return "Hello";
break;
case "2":
   return "World";
break;
..

#8

Ah i see thx it had me so confused


#9

break is unreachable after return. It is not needed and superfluous.


#10

Check this line against the sentence given in the instructions. There is a missing space after the first period.


#11

A post was split to a new topic: Does anyone know what I missed?


#12

remove the "prompt" part altogether