Syntax error unexpected if token 5/9


#1



im stuck on the rock paper scissors 5/9


it says syntax error unexpected if token


 

var compare = function (choice1, choice2)
    if(choice1===choice2)  {
        return ("the result is a tie")
    }  else  {
        return("boom")
    }
        compare(computerChoice, userChoice);


#2

your function have no block( {...} )
then, after all of the command insert ' ; ' , returns have no semicolon.


#3

what do u mean by no block


#4

this is your code.

function (choice1, choice2)
    if(choice1===choice2)  {
        return ("the result is a tie")
    }  else  {
        return("boom")
    }

your function have no block means

function (choice1, choice2) { ... }

now your code must be change to

var compare = function(choice1, choice2) {
    if(choice1===choice2) {
        return("the result is a tie");
    } else {
        return("boom");
    }
};
compare(computerChoice, userChoice);

#5

it doest work for me