Syntax error "what if choice1 is scissors"


#1


Well it keep returning an error , problem with syntax. but i dont see where is the error. Can someone give me a tip?


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"
}
}


#2

No opening bracket after this line, {

You need to closing brackets after this line for the else if and the else
}
}

There needs to be a semi colon after the string of this return statement,


#3

thanks didint see that


#4

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