Need help. My code works and is correct but not going through


#1

I've done this exercise and used a switch statement to get the desired result. The whole thing works when I run it, however I'm not being allowed to continue. It advises me to use the switch method which that's what I'm using. Can't figure out why it doesn't let me go through.

var reviews=prompt("Get the review for the following movie.","Please type in the title of the movie...");

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


#2

So along with your prompt you still need to nest your variable getReview in a function for your switch statement to be complete.


#3

Thanks bibleman13.
Noob error.
This worked for me:

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

#4

No problem man! Glad to have helped! Honestly, I thought it was fine too at first glance haha


#5

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