5. Logical Operators - Syntax Errors - Help Please


#1



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


I have a lot of syntactical errors that I would like to sort out. Most times I would just halfway do it to pass, but I'd like to see how to correct my current code.


var user = prompt("Which University is the best in Kansas? KSU, KU, or WSU").toUpperCase();

switch (user) {
    case "KSU" :
        if (prompt("Do you go to KSU? YES or I Wish").toUpperCase() === "YES" || "I Wish") {
            console.log("Good. I like you");
            break;
        }
        else {
        console.log("Good choice. If you are in college, transfer.");
        break;
        }
    case "KU" :
        if ((prompt("Do you go to KU?".toUpperCase() === "YES") && prompt("Do you dislike KSU? YES or NO") === "YES") {
            console.log("I really dislike you");
            break;
        } else {
        console.log("At least you have time to change");
        break;
    case "WSU" :
        console.log("You need better taste in rivalries");
        break;
    default :
        console.log("We don't care about this school");
        break;
}


#2

it is not that bad, first this one:

else {
        console.log("Good choice. If you are in college, transfer.");
        break;
        }
 /* break should be here */

break should be after your else, not inside your else

then your if statement:

if ((prompt("Do you go to KU?".toUpperCase() === "YES") && prompt("Do you dislike KSU? YES or NO") === "YES")

you have two opening ( for your if statement, which you can do (not sure why) but this means you also need two closing brackets.

then there is one problem remaining:

else {
        console.log("At least you have time to change");
        break;

you are missing the closing curly bracket (}) of else before your break, i believe that was all


#3

@m1_ckey

var user = prompt("Which University is the best in Kansas? KSU, KU, or WSU").toUpperCase();

switch (user) {
    case "KSU" :
        if (
    prompt("Do you go to KSU? YES or I Wish").toUpperCase() === "YES" ||
    prompt("what do want")==="I Wish") {
            console.log("Good. I like you");
            // break;
        }
        else {
        console.log("Good choice. If you are in college, transfer.");
        //break;
        }
        break;
    case "KU" :
        if ((prompt("Do you go to KU?").toUpperCase() === "YES") &&
        prompt("Do you dislike KSU? YES or NO") === "YES") {
            console.log("I really dislike you");
            break;
        } else {
        console.log("At least you have time to change");
        }
        break;
    case "WSU":
        console.log("You need better taste in rivalries");
        break;
    default :
        console.log("We don't care about this school");
        break;
}