4/33 "Check the review of Toy Story 2"


#1

I've checked and rechecked this and looked at all the other "4/33" posts. What am I doing wrong? I think my "review" syntax is correct. Help - thanks!!

var name = prompt("Enter movie.").toUpperCase();

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!";
    }

};


#2

You don't even call the function in your code!


#3

I have tried a lot of things, including calling the function:

getReview(movie);

I still get the same error as I stated above.


#4

What is the error's text?


#5

"Oops, try again. Check the review of Toy Story 2"


#6
var name = prompt("Enter movie.").toUpperCase();

when you using this, then you should call the function , like this

getReview(name);

and not this:

getReview(movie);

#7

Thanks, @no_zeros. As I recall, I tried calling the function with "getReview(name);" before, but still got the same error message. After getting your reply, I tried it as you said (my code below, fyi), but still get the error message: "Oops, try again. Check the review of Toy Story 2".

var name = prompt("Enter movie.").toUpperCase();

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(name);


#8

because you have to write the same sentences which is our exercise .... for example : " Toy Story 2" and not "TOY STORY 2"...


#9

JS is case sensitive ... :laughing:


#10

Aha - got it. Thank you! I was focusing on only getting the Review syntax correct, and figured that my .toUpperCase() method would not cause any problems.


#11

yeah, i understand .. your code is correct too... Your welcome! :smile:


#12

They just didn't expect someone would remember about this .toUpperCase(). But anyway you can use it like this:

switch(movie.toUpperCase()) {

#13
var getReview = function (movie) {

var movie = prompt("what your favorite movie?").toUpperCase();
switch(movie.toUpperCase()){
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 dont know that movie";
break;
}
};

ive got problem. ur site say that code is works, but it has infinite questions, where is problem?)


#14

Asking user for a movie inside the function is wrong. Here's what you have to write underneath the function:

var name = prompt("what your favorite movie?");
getReview(name);

And you have to remove this string from the function:

var movie = prompt("what your favorite movie?").toUpperCase();

movie is a parameter which the function will use, its value (attribute) should be input when calling the function. The attribute in this case is the "name" variable which the function will understand as movie.


#15

i got stuck on it too


#16

var getReview = function (movie) {
var name = prompt("type a movie name!").toUpperCase();
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 song.";
    break;

default:
    return "I dont know!";
    break;

}
};

Type in the movie you like to review and then cancel it it will accept your input and let you go to the next level :wink:


#17

Here is my code and it worked
`

   var choice = prompt("What is the movie you want a review for?");

   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(choice));

`


#18

Try this guys! it is working fine for me.

> var movie = prompt("What is your favorite movies?");

> 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(movie);

#19

What is Wrong ?????
var name = prompt("Enter movie");
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 (name);

It says "Oops, try again. Check the review of Toy Story 2"


#20

This exercise checks the punctuation of the words that we enter in the return part, it has to be exact like the instructions shows, is better copy and paste the name of the movies and their reviews, it took me some time to realize that -_-.

and the code just need to be like 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:
            return "I don't know"
        }
};

getReview("The Lion King");

Nothing more, nothing less. I hope that I helped.