I have to celebrate


#1

Odd issue...I have this piece of code im fairly certain it's written correctly:

var getReview = function (movie) {
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("Finding Nemo");

When i run it that it always says to check my "Toy Story 2" review and I can't move forward.


#2

var toyStoryTwo = {
name: "Toy Story 2",
review: "Great Story. Mean prospector."
};

var findingNemo = {
name: "Finding Nemo",
review: "Cool animation, and funny turtles."
};

var theLionKing = {
name: "The Lion King",
review: "Great songs."
};

var getReview = function (movie) {
switch (movie) {
case "Toy Story 2":
return toyStoryTwo.review;
case "Finding Nemo":
return "Cool animation, and funny turtles.";
case "The Lion King":
return theLionKing.review;
default:
return "I don't know!";
}
};

var user = prompt("Coose a movie!");

getReview(user);

try this it works


#3

hmmm that's odd....i don't understand why you would need to create objects to hold those values and then call return on it. Not sure why returning the string would not work vs your method.

When i call the function at the bottom and pass in a movie title, it does output the correct review so I assume it is working correctly, not sure why it keeps saying to "check the review of toy story 2".


#4

You forgot a space between Great story. and Mean prospector!