Movie reviews


#1


totally screwed up?

SyntaxError: Unexpected identifier
Oops, try again. There was a problem with your syntax.


var movie = {
    
    toyStory: {
        
        name: "Toy Story 2",
        review: "Great story. Mean prospector"
    }
    
    findingNemo: {
        name: "Finding Nemo",
        review: "Cool animation, and funny turtles"
    }
    
    LionKing: {
        name: "The Lion King",
        review: "Great songs"
    }
}

var getReview = function (movie) {
    switch (movie) {
        
        case toyStory: 
            console.log(toyStory.review);
            break;
        case findingNemo:
            console.log(findingNemo.review);
            break;
        case lionKing:
            console.log(LionKing.review);
            
    
    }
}


#2

It never says to create a variable for the movies.

You're just supposed to write a switch statement that cycles through an unknown yet assumingly existent input.

I would recommend hitting reset code and rereading the instructions.

Hope I Helped :slight_smile:


#3

Ok...

but would the code be good in another circunstance?


#4

Mostly. My only critique is that in your function, you use "movie" for a parameter.

It's never a good idea to use a variable when creating a function.

And for your cases, you would need to either make it known that toyStory was a property of "movie", or you would want to add quotes.


#5

thank you for your help


#6

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