My code runs only the 'default' statement!....Please Help ASAP!


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

switch(user) {
    case 'Azeem':
        var name1 = prompt("You're still the same person!");
            if (name1 == 'Azeem' && 'Kazeem') {
                console.log("I'm ur friend.")
            }else {"I don't know you!"};
        console.log("I know u!");
    case 'Buck':
        var name2 = prompt("That's me!");
            if (name2 == 'Buck' || 'Kamari') {
                console.log("All me!")
            }else {"Not Clement Oboh!!!"};
        console.log("My nickname!");
    case 'Huzaifa':
        var name3 = prompt("Huzy Pankus Chanklinkon...");
            if (name3 == !"Huzaifa" || !"Pankus") {
                console.log("You're not Chanklinkon!")
            }else {"Huzy my man!"};
        console.log("The NDA man!!");
    default: console.log("I don't know you!");


Hi this line

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

remove this .toUpperCase(); because your case are both uppercase and downcase..And remenber to write Azeem or Buck


Thanks. I thought '.toUpperCase()' was there to turn every response to upper case.


YEs it does that but you case are uppercase and downcase

case 'Azeem':

so if you type Azeem the .toUpperCase(); will change it to


and it will print the default case because it won't match with any case


Okay I understand it now. Thanks a bunch!


Okay. My if statements don't just runs the case and ignores the if statements.


why not , what does it print?


When i type in Azeem Kazeem, it says > I don't know you!


Becasue you made it with**And**

if (name1 == 'Azeem' && 'Kazeem')

or you create two promp one for Azeem another for Kazeem or you pu it like that

if (name1 == 'Azeem Kazeem')


i still don't understand. Basically all if statements don't work


I run you code and it work.. Let's says you type Azeem

 var name1 = prompt("You're still the same person!");
            if (name1 == 'Azeem' && 'Kazeem') {

then the name1 prompt you CAN'T TYPE Azeem Kazeem because your if statenemt check for the name Azeem and Kazeem and not for Azeem Kazeem


Yes you're right. My bad..i first typed in names in the if statements before the case


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