4/6 Choose Your Own Adventure 2


#1

It's saying my code is correct and giving me the "Way to go!", but no matter what pet I choose I always get the default answer. So something isn't right. Here is my code:

var user = prompt("What is your favorite pet?").toUpperCase();

switch(user) {
    case 'Dog':
        console.log("Dog's are my favorite too!");
        break;
    case 'Cat':
        console.log("Cat's are very good hunters and will keep the pests away.");
        break;
    case 'Snake':
        console.log("Hm... I'm not a fan of reptiles as pets. I think they need to live in their natural habitat.");
        break;
    default:
        console.log("As long as you take care of your pet, love it, and keep it as comfortable and happy as possible I think that's great.");
}

#2

Right there, you are turning all responses to uppercase, so typing dog or Dog or doG, etc. will turn into DOG. You aren't checking for a case 'DOG' so it falls through.


#3

Rookie mistake :stuck_out_tongue_winking_eye: Thank you!