Syntax Error in the rock, paper, scissors code, please help


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/3?curriculum_id=506324b3a7dffd00020bf661#


My code keeps coming up with an 'Unexpected token else' error and I cant seem to fix it no matter what I try.
Any help to fix this is appreciated


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


#2

your else if:

else if (choice2 === "scissors") {

}

inside your else if you nest a if and a else:

else if (choice2 === "scissors") {
 if (condition){
     # do something
  } else {
     # do something else
  }
}

however, the else if should still be closed (}) before moving on to the next else if


#3

Thanks that has helped fix it


#4