5.Logical operators


#1

Hi i got
var month = prompt("What's the day fo the month");
switch(month) {

case 0:

    if(day == 1 && day==4 || day==19 || day==13) {
        console.log("Happy New Year");
    }
    else {
        console.log("Happy January");
    }

    break;

/* ... */

}

but no info in the console. what is wrong?
Scipt is made as correct


#2

Try putting the 0 in case 0 in quotation marks. Then check to see if day should be the variable being evaluated. You never create a day variable, you have a month variable. I would change all your day in the if condition to month.

Did you mean to use && in the if condition? You would use this to check if 2 different variables were present trigger a condition.


#3

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