What if choice1 is rock? SyntaxError: missing ) after condition


#1



SyntaxError: missing ) after condition says I'm missing this after a condition the only problem is I'm not missing a ).

var compare = function (choice1,choice2){
if (choice1 === choice2) {
    return "The result is a tie!"
}

else if (choice 1 === "rock") {
   
    if (choice 2 === "scissors") {
        return "rock wins";
}
else {
    return "paper wins";
}
}
}


#2

Hi these lines

else if (choice 1 === "rock")
if (choice 2 === "scissors")

remove the space between choice and the number 1 and 2 should be choice1 and choice2


#3

Thank you for your help


#4

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