I am having problems with step 6 of the rock paper scissors game


#1

I am inputting the following code:

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

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

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

}

However I am getting the "Oops, try again. There was a problem with your syntax." error. Can anybody please help and tell me what I am doing wrong.

Thanks


#2

The problem is that return statements are only valid inside functions. You are using return statements but you don't have a function in which to put them.

What you need to do is create a function with two parameters: choice1 and choice2.

If you have any more questions feel free to ask :slight_smile:


#3

Thanks a lot for the answer. It helped me finish creating the game.


#4

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