Always returns the same response in console.log()?


#1

I always get the same output from console.log(). It continues to give me the default response no matter WHAT my input is, even if it matches the cases I have created. Please help me identify the issue - have I missed a curly bracket or misplaced something? I can pass the activity but cannot actually get the correct output...


var user = prompt("What is your name?").toUpperCase();
switch(user) {
    case 'Casey':
        console.log("Hey, youre back!");
        break;
    case 'Anonymous':
        console.log("Mysterious...");
        break;
    case 'John': 
        console.log("Welcome John!");
        break;
    default:
        console.log("Never heard of you before!");
    };


#2

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

toUpperCase(); makes Casey to CASEY

And in your cases are no String CASEY, so you get the default


#3

Oh yeah, thanks! That's it!


#4

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