How is this not a switch statement?


#1

Oops, try again. Better use a switch statement

var getReview = function(movie) {
    switch(getReview) {
        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 do use a switch statement, but the switch is on the function instead of the function parameter:

 switch(getReview) // switch on the function?

i would use the function parameter instead, since this will hold the value when calling the function


#4

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