Build "Rock, Paper, Scissors" - What if choice1 is paper?


#1


I get a "SyntaxError: Unexpected token return" error. Any help is much appreciated!


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


#2

you forgot "{" for else and return doesn't need to be in "()"
if it still doesn't work, you didn't put ";" at the end of commands. like the brackets at the end
ex:
"};
};"


#3

Thank you, my friend! My problem was the "{" I forgot as well as the "()" I inserted.

Thanks again!