Having an issue with 7. what if choice1 is paper?



SyntaxError: Unexpected token else

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"


Hey @teasdale.st

You have forgotten to put the curly brace for the if statement inside your first else if statement, your else statement should technically fall inside the aforementioned else if statement. Same thing will apply to the second part of your compare function.You must put the curly brace for the if statement, and put the else inside of the else if. Hope this clears things out...


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.