I have to celebrate you baby problem HELP i AM GOING NUTS


#1


I have to celebrate you baby


The error message says "ReferenceError: movie is not defined"


var getReview = function () {
var getReview = prompt("Which movie did you like best?");
    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();


#2

Hi there

A Movie variable is not defined above your case statement that's why it's throwing a ReferenceError.
Did you mean to switch(getReview)?
getReview is the variable that contains the movie you're testing for.


#3

Hello,

I did and now it's saying '' Better use a switch statement". Another question, does the Window prompt() Method have to separate from the actual function?


#4

In your above code you define getReview twice. It seems that the second definition should be instead var movie = prompt(...); so that the text that the user enters is stored in the movie variable.

...And it should be indented one more level.


#5

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