Why is this code wrong? I've tried everything


#1

I'm on 4/9 of the rock paper scissors, could some ne tell me what is wrong with my code
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";
}
}

Replace this line with your code.

`


#2

your function:

var compare = function(choice1, choice2)
{

the { of your function doesn't have a matching closing }, add the } at the right place


#3

where should the two brackets be?
is it the only mistake?


#4

two brackets? the { exist, you only need to add } at the end of your function. (think carefully where this should be.


#5

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