Help me


#1

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 "papers wins";
}
else if(choice1 === "paper") {
if(choice2 ==="rock") {
return "paper wins"
}
else {
return "scissors wins";
}
};


#2

I don't get the problem


#3

Hi you missing two } one for closing your else if statement and the other for closing the compare function here

else if(choice1 === "rock") {
if(choice2 ==="scissors") { 
return "rock wins"
}
else {
return "papers wins";
}
}  <=== for closing the else if statement

And here

else if(choice1 === "paper") {
if(choice2 ==="rock") {
return "paper wins"
}
else {
return "scissors wins";
}
};
}  < == for closing the compare function

#4

I keep on getting syntax errors. Why :frowning:

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


#5

Hi you got more } than you need here

else if(choice1==="rock") {
if(choice2 === "scissors") {
return"rock wins"
};
} <=== you shouldnt close the else if statement here remove it 
else {
return "paper wins"
}
}<== you should close your else if statement here
}; <=== this one close the compare function 
}<== remove this one