4. Movie Reviews, Getting errors already look at other correct examples


#1


Lesson 4. https://www.codecademy.com/courses/spencer-sandbox/0/4?curriculum_id=506324b3a7dffd00020bf661#


Errors: "SyntaxError: Unexpected token"
"Oops, try again. There was a problem with your syntax."

I looked at several posts on this and can't figure out what I am missing or what I did wrong...


var getReview = function (movie) {
    switch(movie){
        case "Toy Stroy 2";
            return "Great Stroy. Mean prospector.";
        break;
        case "Finding Nemo":
            return "Cool animation, and funny turtles.";
        break;
        case "The Lion King":
            return "Great songs.";
        break;
        default;
            return "Movie not found";
    }
};

getReview("Finding Nemo")


#2

Well, this is not the immediate problem but Toy Stroy should be Toy Story


#3

do you notice anything about this line? You're supposed to introduce the case and use a colon to proceed, but you used a semicolon.

Also as @bibleman13 pointed out, make sure that all of your strings are spelt exactly how they ask you to.


#4

here:

case "Toy Stroy 2";

that should be a colon, not a semi-colon. same for default

and you misspelled Story, twice. in both the case and the return. The string returned should also be an exact match, in which story is written with lowercase s


#5

Can't believed I messed that stuff up, but it still persists same errors.
getReview("Finding Nemo")

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 "Movie not found";
    }
};

getReview("Finding Nemo")

#6

change the semi colon to a colon like Stetim94 said and you should be fine


#7

FOUND IT MYSELF!
default had semi colon.
Also read to fast on Stetim94's comment

Thanks all!


#8

you still have a semicolon here


#9

also S needs to be lowercase in "Story"


#10

you missed this point. just copy the strings from the instructions otherwise


#11

Thank you all. =)

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 "Movie not found";
    }
};

getReview("Finding Nemo")

#12

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