Scissors part!


#1

Hey, i can't seem to find the error in my rock paper scissor code:

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 === "rock") {
return "Rock wins";
}
else {
return "Scissors wins";
}
}
}
}

Error: Unxpected token else, which seems to be in the last one, but i dont understand why. Thanks


#2

Hi this part its missing the }

else if (choice1 === "paper") {
if (choice2 === "rock") {
return "Paper wins";
}
else {
return "Scissors wins";
}
}< === add one here

=========

An this part you have more than you need

else if (choice1 === "scissors") {
if (choice2 === "rock") {
return "Rock wins";
}
else {
return "Scissors wins";
}
}
}
}<=== Remove this one