Could someone help me please!


I have been working on this for quite some time and according to my research it is correct, but it says I have a syntax error. Please help.

/*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)
    return "The result is a tie!";
else if(choice1==="rock"){
      return "rock wins";
    return "paper wins";
else if(choice1==="paper"){
        return "paper wins";}
        else {
        return "rock wins";


In the hint for this lesson, you are given a format to use for your else if statements:

else if (choice 1 code){
if (choice 2 code)
{ return "something wins"; }
{ return "other wins"; }

Remember that curly braces wrap around code waiting to execute if a certain condition is present. Make sure all your braces are where they need to be. Check all your conditions.

It might help to input your code into a site like You'll see exactly what lines the errors in your code are.


My code is according to that rule? Could you be more specific please?


Is a curly brace missing?

Is a curly brace missing?


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