I'm stuck in this lesson! HELP!



"oops try again. check the review of Toy Story2"

var user = prompt ("Enter your favorite movie").toLowerCase();
var getReview = function (movie) {
    switch (movie){
        case 'Toy Story2':
            return ("Great story. Mean prospector.");
         case 'Finding Nemo':
            return ("Cool animation, and funny turtles.");
        case 'The Lion King':
            return ("Great songs.");
            return ("I don't know!");


Continuing the discussion from 4.I have to celebrate you baby:


Since you're using .toLowerCase() shouldn't be the case's in lowercase?


Just removed the.toLowerCase , solved the whole thing!
thanks a lot !


In fact, the way you did it was better, say a user choices "toy story2" (in lowercase) the case is there, but it wouldn't work. Using the toLowerCase function would help in those situations.


so when i put .toLowerCase to the prompt statement like earlier , i have to include the movie names under switch statement in lowercase too??


Yes! because you're comparing lowercase strings :slight_smile:


For this exercise we should not be converting the case. It is improper. The data contains proper names that we should respect. Don't fudge data just to make your code work. That's a bad habit to start and will come with many hair pulling problems down the road.

Case parameters are data in the form of an expression.

The second thing to be aware of is the return values of prompt(). There are two possible returns, a string (may be empty) or null. The latter has no properties since it is not an object, so it cannot call a method it does not have in its prototype (also something it does not have, a prototype object).

If a user clicks Cancel or presses the Esc key, prompt() returns null. This will throw an exception and kill the program if we try to apply .toLowerCase() or .toUpperCase(). Always test the return for string type before applying any string (or object) methods on it.

    var user = prompt("...");
    if (user !== null) {
        // code here
    } else {


thank you for the tip :slight_smile: