Movie review exercise (Debugg needed)


#1


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


#2

Is the problem just that I misspelled the required review?


#3

When we use return, there is no need to use parenthesis.

The same goes for you cases. You are slightly over complicating it, it should look like this. There is no need to use equal signs.

case "Toy Story 2":

#4

Oh. Thank you!
What should be the review for "The Lion King"? It says its not right.

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


#5

You are still using parenthesis in your return statements. Just like you did with the cases remove the parenthesis.


#6

Ohhh. Thank you!
(It's been a while since I've used these as well. ^-^)


#7

All good man, happy to help :slight_smile: Glad its solved now.


#8

Although, it says that "The Lion King" Still isn't right.


#9

It should look like this

case "The Lion King" :
return "Great songs.";


#10

Thank you!
I'm not sure why it didn't work the other way.


#11

Al good feel free to ask me any JS related questions.


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.