Something wrong in switch statement


#1

var user = prompt("who are you?").toUpperCase();
switch(user) {
case 'aaa':
console.log("qwerty");
break;
case 'zzz':
console.log("asdfgh");
break;
case 'sss':
console.log("zxcvbn");
break;
default:
console.log(1234567);
}
What is wrong in this code?
Even though I am writing a correct words in the three cases, iam getting the default answer.
Please give the reply as fast as possible

Replace this line with your code.

`


#2

you convert the user input to uppercase, and then check cases which all exist out of lowercase strings


#3

var user =prompt("who are you?").toUpperCase();
switch(user) {
case'aaa':
console.log("qwerty");
break;
case'zzz':
console.log("asdfgh");
break;
case'sss':
console.log("zxcvbn");
break;
default:
console.log("asderfg");
break;
What is wrong in this?
lchp.5 logical operators


#4


#5

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