I have to celebrate you baby


#1


This is my code for the challenge "I have to celebrate you baby". It works and displays the review, but won't let me pass the challenge. It says that I need to use a switch statement and I'm pretty use this is a switch statement. I must have something out of place or something?


var getReview = function (name) {

switch(name) {    
case 'Toy Story 2': 
    console.log("Great story. Mean prospector.");
break;

case 'Finding Nemo': 
    return("Cool animation, and funny turtles.");
break;

case 'The Lion King': 
    console.log("Great songs.");
break;
default:
console.log("I dont know!");
break;
}
};

getReview("The Lion King");


#2

It works fine for me. What's your error message?


#3

It says that I need to use a switch statement. Which I have used a switch statement.


#4

Could you post a screenshot of what you're seeing, please?


#5


#6

I see where on Finding Nemo, I used return instead of console.log. I switched it to console.log and it still won't let me pass and says the same thing "Better use a switch statement".


#7

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:
        return "I don't know!"
        break;
    }
};

getReview ('Finding Nemo');

Key differences are that the return function was used for all three, the brackets were removed from around the text set to be returned, and the function name is set to 'movie' instead of 'name'.


#8

Thank you for the info, I understand now. It passed!


#9