I have to celebrate you baby


#1



https://www.codecademy.com/en/courses/spencer-sandbox/0/4?curriculum_id=506324b3a7dffd00020bf661


Hello everyone! I have a Problem with this Exercise.Every time when I run this code it says "Oops, try again. Better use a switch statement"


var getReview = function () {
var title = prompt("Movie?");

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


#2

HI that lesson is a bit strange because you shouldn't change anything they gave you at the begin..

var getReview = function (movie) {

};

so if they gave you that you should have in your code a function called getReview with an argument movie if you change that it will throw you that error

"Oops, try again. Better use a switch statement"

so since you want to insert the name movie with prompt you could do it like that

var movie_name  = prompt("Movie?"); #here put the prompt

var getReview = function (movie) {

#here you should put the switch statement

};

getReview(movie_name) #in your call function pass the variable where you save the prompt

Hope that could help you


#3

Hello,
I have a different issue with this lesson.
Below is the code I used.
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")
}
};

var film = prompt("What movied did you see?");
var review = getReview(film);
console.log(review);

I am finding that I get the correct answer AND then I get "Great Story. Mean Prospector" and some other response. Why does it seem to go back and execute again?
Also I get the class error "Are you returning the right thing?"

Any assistance will be appreciated
Sydney


#4

Here is what you have

switch (movie){
case ("Toy Story 2"):
console.log ("Great story. Mean prospector.");
break;

There are two things it is probably unhappy about as this lesson is very picky
First instead of console.log it wants you to use the return keyword
Second your syntax for you switch is a little off. It should look something like this,

switch(movie) {
case 'Toy Story 2':
return "Great story. Mean prospector.";
break;


#5

var getReview = function (movie) {

switch(movie){
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!";
}
};