4. I have to celebrate you baby. CONSOLE ISSUE?!?!


#1

So I'm coding together a switch on this exercise and something weird keeps happening. Well, here's the coding:

var reviews = {
    "Toy Story 2": "Great story. Mean prospector.",
    "Finding Nemo": "Cool animation, and funny turtles.",
    "The Lion King": "Great songs."
};

var getReview = function(movie) {
    switch (movie) {
        case "Toy Story 2":
            console.log(reviews[movie]);
            break;
        case "Finding Nemo":
            console.log(reviews[movie]);
            break;
        case "The Lion King":
            console.log(reviews[movie]);
            break;
        default:
            console.log("I don't know!");
    }
};

var choice = prompt("The Lion King, Toy Story 2 or Finding Nemo?");
getReview(choice);

In this particular exercise, I keep getting a return of:

<PROPER REVIEW OF WHICHEVER I CHOOSE GOES HERE>
Great story. Mean prospector.

That second line ALWAYS pops up. I've tried this code out in other windows and the second return line does NOT show up. Any ideas out there?

Thanks.


#2

Imagine you have a movie collection, and you want to write code that returns your review

... instead of logging it. You are seeing result of the lesson checker test, in addition to your own.


#3

Gah. Thanks again. Sorry for the dumb questions, but it's only way I get smarter.


#4

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