Less 6 (Logical Operators) - Code Your Own Adventure....Can someone please help with my code


#1

Here is a link to the section I am stuck on:
https://www.codecademy.com/en/courses/javascript-beginner-en-ZA2rb/0/5?curriculum_id=506324b3a7dffd00020bf661#

Following is my code. I'm receiving the following error message: "Syntax error: unexpected token else. I cannot figure out what I am doing wrong. Please help.

var user = prompt("You're in Pixie Hollow and you run into a fairy. Is it Tinkerbell, Vidia or Silvermist?").toUpperCase();

switch(user) {
case 'TINKERBELL':
var dress = prompt("Does she have a green dress (YES or NO)?").toUpperCase();
var shoes = prompt("Does she have fluffy green shoes (YES or NO)?").toUpperCase();
if(dress == 'YES' || shoes == 'YES'); {
console.log("She is wearing green something!");
} else {
console.log("She isn't wearing any green at all!" );
}
break;

case 'SILVERMIST':
    var handbag = prompt("Is her bag blue (YES or NO)?").toUpperCase();
    var hairband = prompt("Is her hairband blue (YES or NO)?").toUpperCase();
    if(handbag == 'YES' && hairband == 'YES') {
    console.log("Both her accessories are blue!");
    } else {
    console.log("Her bag and hairband don't match");
}
break;  
default:
    console.log("You didn't mention a fairy!");

}

I am getting an error message: Incorrect syntax: unexpected token else


Replace this line with your code.


#2

Hi
could you remove the semi-colon just after the if and before the opening { ?

When I remove it, the code works for me
Cheerio


#3

Thanks so much! It worked. Really appreciate your speedy response