[Solved] Introduction to Objects I movies and reviews


#1

Write a function named getReview that takes in a movie name and returns its review based on the information above. If given a movie name not found just return "I don't know!". Use a structure learned in an earlier lesson (NOT if/else statements) to write this function.

My code:

var getReview = function (movie) {
var user = prompt("Enter movie name")
switch (user) {
case "Toy Story 2":
console.log("Great story. Mean prospector.")
break;
case "Finding Nemo":
console.log("Cool animation, and funny turtles.")
break;
case "The Lion King" :
console.log("Great songs.")
break;
default:
console.log("I don't know!");
};
};

getReview()

And it says to me: "Oops, try again. Better use a switch statement"
What am I doing wrong?


#2

#3

If still stuck at the very end of your script there is
getReview()
If I am correct you are told to get the review for The Lion King... wich means getReview() should look like this..
getReview("The Lion King")
Hope it helped... if not well then let ppl know in by answering.


#4

No, it doesn't work, same problem. It just says Better use a switch statement.


#5

I copied this code and it worked

var name = prompt("Which movie would you like to review");
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";
}
};
console.log(getReview(name));

So I guess its a bug on codecademy, or not telling exactly how the task needs to be done


#8