I don't understand nesting!


#1


Hello there! For some reason, I don't understand what I'm doing with the && and || commands here? I'm pretty sure that they need to be numerical, cuz that's what the example stated. However, the code doesn't really fit in with the scenario I'm coding. Please help!

https://www.codecademy.com/courses/javascript-beginner-en-ZA2rb/0/5?curriculum_id=506324b3a7dffd00020bf661#

SyntaxError: Unexpected token )

. 
var user = prompt("Do you like Beyonce?").toLowerCase();

switch(user) {
    case 'Yes':
        console.log("Hell Yeah you do!");
        break;
    case 'No':
        console.log("Beyhive Heaux!");
        break;
    case 'IDK':
        console.log("Eh. Listen to self-titled.");
        break;
        case 0:
        if (listen == 1 || 2>) {
            console.log("Thanks for giving her a try!")
        }
        else(0 && 1) {
            console.log("Well, pick and albulm!")
        }
    default:
    console.log("Excuse me, come again?");
}


#2

Hi,

Here's a FAQ for you to read: Comparisons : Explanation

else doesn't take a condition .. syntax is just like this:

else{
//something
}

also don't forget semi colons at the end of console.log
missing a break;


#3

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