What's wrong with my code?


#1

var user = prompt("What are your favorite seasons?").toUpperCase();
console.log(user);
switch(user){
case 'SUMMER':
var tan = confirm("Do you sunburn easily?").toUpperCase();
var time = confirm("Do you spend time outside a lot?").toUpperCase();
if(tan && time === true){
console.log("You must not mind being red all the time!");
};
else if(!tan && !time){
console.log("You must enjoy air conditioning");
};
break;
case 'WINTER':
var snow = confirm("Do you like snow?");
var cold = confirm("Do you like the cold?");
if(cold || snow){
console.log("You were made for winter.");
};
else if(!cold && !snow = true){
console.log("Why do you like winter?");
};
console.log("Move to canada bro...");
break;
case 'FALL':
console.log("In Pennsylvania, the multicolored maples are beautiful.");
break;
case 'SPRING':
console.log("You like waking up from the dreariness of winter don't you?");
break;
default:
console.log("I don't know of the season. Are you from a different planet?");
break;
};


#2

@pulsar99,
You are using a semi-colon-; in your IF ELSE-IF statement construct.

if (condition) {
    //IF code-block
}
else if {
    //ELSE-IF code-block
}

#3

ReferenceError: Invalid left-hand side in assignment

var user = prompt("What are your favorite seasons?").toUpperCase();
console.log(user);
switch(user){
case 'SUMMER':
var tan = confirm("Do you sunburn easily?").toUpperCase();
var time = confirm("Do you spend time outside alot?").toUpperCase();
if(tan && time === true){
console.log("You must not mind being red all the time!");
}
else if(!tan && !time){
console.log("You must enjoy air conditioning");
};
break;
case 'WINTER':
var snow = confirm("Do you like snow?");
var cold = confirm("Do you like the cold?");
if(cold || snow){
console.log("You were made for winter.");
}
else if(!cold && !snow = true){
console.log("Why do you like winter?");
}
console.log("Move to canada bro...");
break;
case 'FALL':
console.log("In Pennsylvania, the multicolored maples are beautiful.");
break;
case 'SPRING':
console.log("You like waking up from the dreariness of winter don't you?");
break;
default:
console.log("I don't know of the season. Are you from a different planet?");
break;
};


#4

@pulsar99,

!snow = true