I Have to Celebrate you Baby. (Reviews error?)


#1

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

So my code is fine as long as I can see except that a get the error: Oops, try again. Check the review of Toy Story 2. And I literally copy-paste the 3 reviews. I don't know what to do...
I also was wondering why am I asked to write 3 times the name of the movie I want to get the review from and not just once? Thanks to anyone that could help me

var getReview = function (movie) {
var movie = prompt("Toy Story 2, Finding Nemo or The Lion King");
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!";
    break;
}
};
getReview();


#2

The string on that line should be "I just don't know!" and not "I don't know!"


#3

Well the instructions say that you should write "I don't know!" not otherwise. I also copy-paste ed that part. And just to verify i did as you said and the mistake keeps targeting the toy story review


#4

so, you already create a function with 1 parameter, but when you call it you dont give any parameter to that

getReview(); ---Should be--> getReview("Toy Story 2");

you dont need a prompt to take a value because it will be passed by the function argument

try to do this and let me know if it works!


#5

I changed the parameter to toy story and now the error follows the Nemo review


#6

Show me your updated code


#7


And now back again in Toy Story
Please tell me if you san see the image i'm posting
First time I ran it, the error would mention the nemo review, I don't know what it changed


#8

take the line 2 off, it seems you are overwriting your "var movie"


#9

Well without the prompt command it now works, why is that?


#10

this exercise is very simple. it's just to remember concept of functions and switchs

your code works because your function expects one parameter, and your switch are using that parameter, because of that you dont need prompt to your code works


#11

What is the problem in my code????????


#12

No need of break in default statement. Try removing Line 14 --> "break;"


#13

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