Pls help. What is wrong?


#1


if(choice1 === choice2) {
    return "The result is a tie";
}

else if(choice1 === "rock") {

    if(choice2 === "scissors") {
        return "rock wins";
    }
    else {
        return "paper wins";
    }

}


#2

HI just add one } at the end for closing the compare function


#3

Doesn't work. How did you do it?


#4

Can you post all your code?


#6

if(choice1 === choice2) {
return "The result is a tie";
}
else {
if(choice2 === "scissors" && choice1 === "rock" || choice2 === "paper" && choice1 === "scissors" || choice2 === "rock" && choice1 === "paper") {
return choice1 + " wins ";
}
else {
return choice2 + " wins ";
}
}


#7

I found mistake. Thank you for your help)))
It works :slight_smile:


#8

Thank you :slight_smile:


#9

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