SyntaxError: expected expression, got keyword 'if'


Build "Rock, Paper, Scissors"

        What if choice1 is rock?

Hi, I always get this error message "SyntaxError: expected expression, got keyword 'if'" but I am not sure where I am going wrong. Can someone help? Thanks

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


this line:

var compare = function (choice1, choice2)

a function should have curly brackets:

var compare = function (choice1, choice2){
  /* everything that should be inside the function */


Cheers. That did the trick :slight_smile: