I have to celebrate you baby; code works exactly like I wanted, but the system says I'm wrong?


#1

I'm stuck at 'I have to Celebrate you baby'

For some reason it always says 'oops, try again. better use a switch statement'. Am I just doing the exercise wrong somehow? The code seems to work perfectly; it wanted me to write a piece of code using a switch statement to input a movie title and get a review, and I always get the review for the movie title I type in. I even made sure that as long as it's spelled right it'll get you the review (Stupid casing, lol). So I'm just a little confused I guess; any and all help would be appreciated. :slight_smile:

Here's my code, maybe someone else can notice a problem I can't?

movie = prompt("What movie would you like reviews for?").toLowerCase()

var getReview = function (movie) {
    
};

switch(movie) {
    case "toy story 2": 
    "Great story. Mean prospector.";
    break;
    case "finding nemo":
        "Cool animation, and funny turtles.";
        break;
    case "the lion king":
        "Great songs.";
        break;
        default:
        "I don't know!"
        break;
}

#2

The switch statement should be inside the code body of the function.


#3

Thank you, and it's a good idea, but I tried that before coming to post on here and it just caused an echo of whatever you input and a different error message


#4

Actually, I should amend that. That's what happens if I move it. If I move it and add 'return' in front of the review segments in the cases, then it works but I get a 'oops, try again. check the review of toy story 2' message


#5

Nevermind, I figured it out. Turns out I was going about it wrong; I should've been trying to set it up to use the log rather than trying to use input. thank you for the help. :slight_smile:


#6

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