Stuck on 'I have to celebrate you baby' exercise


I'm having trouble with this exercise. I've built out my objects, switch, and function, but every time I try to run the code, it says that the period separating "reviews" from "toyStory" in my second object is an unexpected token. I've tried notating the new objects using brackets, and rewriting them using standard object syntax, but I get a "SyntaxError: Unexpected token" every time on the first token in my second object, regardless what that token is. I've gone back and double and triple-checked my syntax and everything seems to be kosher.

I don't doubt there are other problems with my code, but right now I'm just looking to get rid of this error message so I can start debugging the thing in earnest.

Thanks in advance!

var reviews = new Object();;
var reviews.toyStory = new Object();
var reviews.findingNemo = new Object();
var reviews.lionKing = new Object();

reviews.toyStory["title"] = "Toy Story 2";
reviews.toyStory["text"] = "Great story. Mean prospector.";

reviews.findingNemo["title"] = "Finding Nemo";
reviews.findingNemo["text"] = "Cool animation, and funny turtles.";

reviews.lionKing["title"] = "The Lion King";
reviews.lionKing["text"] = "Great songs";

var getReview = function (movie) {
    switch(getReview) {
        case 'Toy Story';
        return reviews.toyStory['text'];
        case 'findingNemo';
        return reviews.findingNemo['text'];
        case 'The Lion King';
        return reviews.lionKing['text'];
        return 'I do not know!';


var query = prompt('Choose a movie to see the review');



Whoa there. You didn't need to define all those objects, nor did you have to create a variable or anything. You simply had to create the switch and fill it up with the reviews that the description had. Sorry to be the one to inform you, but you did way more than you had to. :smile:


Derp. Thanks for the heads-up


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