Something different


#1

HI. In exercise 4.I have to celebrate you baby Codecademy in section Hint tells me about using switches.

switch(movie) {
case "Toy Story 2":
// return review here

case "Finding Nemo":
    // return review here

default:
    // code to be executed if a movie name is not found

}

I thought about do it different way. What you think about this? The problem is that i have error "SyntaxError: Unexpected token ." and I do not know what the hack is going on :smiley:

var movie= {

movie.name = {
key: "Toy Story 2",
key: "Finding Nemo",
key: "The Lion King",
}

movie.reveiew = {
key: "Great story. Mean prospector.",
key: "Cool animation, and funny turtles.",
key: "Great songs."
}

};

var getReview = function (movie) {
for(var keys in movie){
if(keys === movie.name[key]){
console.log("zwracam recenzje");
return movie.review[key]
}else{
console.log("I don't know");
}
}
};

PS Merry Christmas :christmas_tree: :gift:


#2

If you're not getting a line number in your error messages, try running it in Firefox's scratchpad which can be accessed by pressing Shift+F4 (has more helpful error messages)