4. I have to celebrate you baby, help


#1

How do I complete this code?

var movies = new Object();

movies.names = ["Toy Story 2", "Finding Nemo", "Finding Nemo"];
movies.review = ["Great story. Mean prospector.", "Cool animation, and funny turtles.", "Great songs."];

var getReview = function (movie) {
    case (movies.names[i])
        
};


getReview(movies.name[0]);

Does it have to be a switch statement?
#2

Hi
The aim of the exercise is to write the function getReview that returns the reviews depending on the name of a movie. So you don't need to write the 3rd line because it is the output of the function.
You could also have a look at the hint below the instructions. Then I am sure that you will find the solution.
Cheerio


#3

var userChoice = prompt("Please enter the name of the movie you want to see the reviews for!");
var reviewToy = "Great Story. Mean prospector.";
var reviewNemo = "Cool animation, and funny turtles.";
var reviewLion = "Great songs.";
var getReview = function (movie) {
switch(userChoice)
{
case 'Toy Story 2':
return reviewToy;
break;

case  'Finding Nemo':
return reviewNemo;
break;

case  'Lion King':
return reviewLion;
break;

default:
console.log("No review found!");
break;

}

};

getReview();

What's wrong with my script? it logs the strings in the console but in the bottom i get "Oops, try again. Better use a switch statement". What am I doing wrong?
Thank you!


#4

try this:

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:
console.log(" no review found");
}
};


#5

It doesn't work. This is the error message I'm getting:
Oops, try again. Are you sure you're returning the right thing?


#6

Yeah, I'm really not getting this one. I know it's something small...

My error tells me to check the review of the Lion King? Um...

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 "Lion King":
return("Great songs.");
break;
default:
return("I don't know!");
}
};


#7

Yup, super simple:
I left off 'The' from 'The Lion King'
WOW - mas cafe...


#8

HI the instruction aske you to..

"The Lion King" - "Great songs."

but you wrote to the name

"Lion King"

it's missing The