I have to celebrate you baby


#1

Hi, I have a problem regarding this exercise.
I wrote the codes as below, but the error message says ". Better use a switch statement".
I have already typed it. I totally don't know what's wrong with my code.

var getReview = function (movie) {
    switch(answer){
        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":
            cosole.log("Great songs.");
            break;
        default:
            return "I don`t know!";
    }
};

getReview();

#2

in you switch, you use answer. Where does this come from? You should apply the switch to movie (your function parameter), this way you can call your function to check for different movies and there reviews


#3

Thank you for your quick reply.
Sorry. I missed to type parameter answer.
Actual code is like this;

var answer = prompt("What movie would you like to search?").toUpperCase();
var getReview = function (movie) {
switch(answer){
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":
cosole.log("Great songs.");
break;
default:
return "I don`t know!";
}
};

getReview();


#4

still my point stands, you should use the function parameter for the switch statement, and then you can pass answer as function argument when you call the function


#5

and
case "TOY STORY 2",: //error coming from here remove ,


#6

Thank you so much. By following your advice, I have solved this problem!


#7

Thank you, I have found this error.