Lesson 8 choice scissors


#1

var compare = function(choice1, choice2) {
if(choice1 === choice2) {
return ("The result is a tie!");
}
else if (choice1 === rock) {
if (choice2 === "scissors") {
return ("rock wins");
}
else {
return ("paper wins");
}
}
else if (choice1 === paper) {
if (choice2 === "rock") {
return("paper wins");
}
}
else {
return ("scissors wins");
}
else if (choice1 === scissors) {
if (choice2 === "paper") {
return ("scissors wins");
}
}
else {
return ("rock wins");
}
console.log("compare: " + choice2);

};

someone please help me cause i'm getting a: SyntaxError: Unexpected token else : message


#2

Your closing braces are misplaced in some cases. There should be two before the else if (excpet the first one) and only one before the else.

if () {
} else
if () {
    if () {
    } else {
    }
} else
if () {
    if () {
    } else {
    }
} else
if () {
    if () {
    } else {
    }
}

#3

thanks i almost had it down too