May you please help me debug my code


#1


var getReview = function (movie) {
    switch(movie) {
    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.");
}
};
getReview("Toy Story 2")


#2

you didn't put semi-colon at the very end


#3

put semi-colon like this after the getReview("Toy story2");


#4

Thank You it works but I keep getting double of toy Story 2 review
var getReview = function (movie) {
switch(movie) {
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.");
}
};
getReview("Toy Story 2");


#5

try getReview();
leave the argument empty


#6

Thank You

var getReview = function (movie) {
switch(movie) {
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.");
}
};
getReview();

These are the results:
script.js

I don't know.
Great story. Mean prospector.


#7

Type this code at the beginning of your code.
var movie = prompt("Choose one from the following , Toy Story 2, Finding Nemo, The Lion King");
First of all it will ask to type the name of the movie like Toy Story 2 then this code will search for Toy Story 2 in the switch statement,
Hopefully , it will work and don't forget to like my post :slight_smile:


#8

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