Stuck with this exercise


#1



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


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


Problem with review
#2

Hi change the name of that object,

    var movie = {
        ToyStory2: "Great story. Mean prospector.",
        FindingNemo: "Cool animation, and funny turtles.",
        TheLionKing: "Great songs.",
    }

then look at

case "The Lion Case":
            return movie.TheLionKing;
            break;

you wrote The Lion Case instead of The Lion King


#3

Should be Var Movie and not getReview right as well? Or can you just use getReview?


#4

it's just because is the same name he gave as argument to the function getReview().. And getReview is rigth..


#5

Must be more then one var correct then, weird. I used Var Movie and it worked fine so I guess everything works.


#6

could you paste your code so i can compare?


#7

Sure but know Marco is correct. He has it right more then I do.

var movie = prompt("Which movie do you want to know about?");

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!";
}
};


#8

Thank you very much!


#9

HI when I said to change the name of your object movie you could do it like that

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

I just add a s to the object movie the same to

return movies.ToyStory2;
return movies.FindingNemo;
.....

#10

Ok I, see now you are talking about the var movie where you saved the input pompt.. yes He could also add it..


#11

No worries, we both just got a little confused.


#12

Thank you for creating a new topic like I said, and I'm glad you got your problem solved. :slight_smile: