Keep saying ''Oops, try again. Check the review of Toy Story 2"


#1

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 ("Finding Nemo");


#2

Seems fine to me, copy your code and refresh your browser then re submit the code.

This issue can sometimes occur, got me a few times too!


#3

Thank you for replying. I tried it several times but same result!


#4

Hi I think that after each case you should put a break

case 'option1':
        // Do something
        break;

#5

You should really have 'Break' after each case:

var getReview = function (movie) {
switch(movie){
case "Toy Story2": 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!")
}
};

Although it does work without codecademy expects exact code, it's good practice to use correct syntax anyway


#6

I'm pretty sure Codecademy has some bug. I deleted : case "Toy Story 2": return .... since the error stated about "Toy Story 2" and refreshed my code. It still keep saying the same message.


#7

A bit of extra info from W3Schools,

'When the JavaScript code interpreter reaches a break keyword, it breaks out of the switch block.

This will stop the execution of more code and case testing inside the block.

Note
When a match is found, and the job is done, it's time for a break.
There is no need for more testing. '


#8

Thanks! That was my original code with break, but the result was same. So I read all the post about this problem, and someone recommended to remove "break;". And still the result is same. At least, it returns the right answer with or without "break;", but it keeps saying the same error and it won't let me go to next step.


#9

Hi, guys! I switched the order of the line: "Finding Nemo....." to the last case. It was totally accident, but now it works fine. I'm so happy to move on to next step.

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


#10

Okay try this:

You have "Great story, Mean prospector.";

But codecadcemy requested return "Great story. Mean prospector.";

Notice that after Great Story there should be a full stop not a comma, these little things are picked up by codecademy


#11

Thanks for your effort!!!!


#13

hi prompt your movie names to ask and also call the function by movie not by the movie name movie parameter has all names in it and also check the return value as same as in the window in question on left. Thankyou! it will work


#14

I had the same issue with mine; it said "Oops, try again. Check the review of Finding Nemo." So on examining it I found that while the instructions said "Cool animation, and funny turtles.", I had written "Cool animation, and funny turtles". So I added a period to the end of the string and it said "Way to go!"

This kind of pickiness drives me crazy sometimes, but I guess that's computers for you! :laughing: