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


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.";
        case 'Finding Nemo':
            return "Cool animation, and funny turtles.";
        case 'The Lion King':
            return "Great songs.";
            return "I don't know!";


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.



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?


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.


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