Switch statement only outputting default regardless of input


#1

My switch statement only outputs the default regardless of my input being a case or not. Here's the code;

` var user = prompt("Cake or death?", "Choose CAKE or DEATH").toUpperCase();

switch(user) {
    case'cake':
        console.log("VERY WELL! GIVE HIM CAKE!");
        break;
    case'tea':
        console.log("Tea is good");
        break;
    case'cake please':
        console.log("Sorry We're out of cake");
        break;
    default:
        console.log("Okay! Death it is!");
}

#2

Look:

var user = prompt("Cake or death?", "Choose CAKE or DEATH").toUpperCase();
case'cake':

You are converting the input to uppercase, yet checking for lowercase, this will never work.


#3

Since your cases are lowercase, replace toUpperCase(); in your prompt to "toLowerCase(); this will make whatever the user inputs lowercase to match your cases.