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

if(choice2 === "rock") {

return("paper wins")

}

else {

return("scissors wins")

}

};

what is wrong with this? Please help I have been stuck on this for a while.

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

if(choice2 === "rock") {

return("paper wins")

}

else {

return("scissors wins")

}

};

what is wrong with this? Please help I have been stuck on this for a while.

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

if(choice2 === "rock") {

return("paper wins")

}

else {

return("scissors wins")

}

}

That doesn't work either. Any other things?

I'm new to this but I believe I was having the same problem and I fixed it by making sure my else if was inside the compare function above it. Delete the closing bracket for your compare function and add a closing bracket to the bottom after return "(scissors wins)"

That's the way:

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

}

}

}

what is my mistake here?

```
var compare = function(choice1, choice2) {
if(choice1 === choice2) {
return("The result is a tie!")
}
else if(choice2 === "scissors") {
return("rock wins")
} else {
return("paper wins")
} else if(choice1 === "paper") {
if(choice2 === "rock") {
return("paper wins")
} else {
return("scissor wins")
}
}
}
```

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

as you can see you need to be careful with your {} because currently you have an else if following an else.

thank you for the replay.

but i still dont get, what is the problem...

I have 2 so how should i do it?

The idea to compare the user and computer choice is to group them:

```
if tie
tie message
else if you choose rock{
if computer choose paper{
com wins
}
else{
you win
}
}
else if you choose paper{
if computer choose rock{
you wins
}
else{
com win
}
}
else if you choose scissors{
if computer choose rock{
com wins
}
else{
you win
}
}
```

So you have 4 cases tie/rock/paper/scissors and each of them, except tie, has 2 options for what the computer has chosen.

Wrote everything again I just can see the problem!! found that i was missing one }.. but i can see any problem!

```
var compare = function(choice1, choice2) {
if(choice1 === choice2) {
return"The result is a tie";
} else if(choice2 === "scissors") {
if(choice1 === "rock") {
return"rock wins";
}
else {
return"paper wins";
}
}
else if(choice1 === "paper") {
if(choice2 === "rock" {
return"paper wins";
}
else {
return"scissor wins");
}
}
};
```

The structure seems to be much better and the } problem seems to be fixed. The problem here is that your else ifs should have the same target:

```
else if(choice2 === "scissors") {
else if(choice1 === "paper")
```

But here one targets choice2 and the other one is targeting choice1. So as choice1 is the userChoice it is probably better to use choice1 there and fix the nested cases accordingly.

Hope this helps:

var userChoice = prompt("Do you choose rock, paper or scissors?");

var computerChoice = Math.random();

if (computerChoice < 0.34) {

computerChoice = "rock";

} else if (computerChoice <= 0.67) {

computerChoice = "paper";

} else {

computerChoice = "scissors";

}

console.log("Computer: " + computerChoice);

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

}

} else if (choice1 === "scissors") {

if (choice2 === "rock") {

return "rock wins";

} else {

return "scissors wins";

}

}

}

compare(userChoice, computerChoice);