Rock Paper Scissor - stuck on "What if choice1 is paper?"


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

I'm not quite sure what I'm doing wrong here. I'm on the "What if choice === paper?" exercise.


You accidentally (I assume :slight_smile: ) added a ' at the end of your return statement. Also take note that you forgot your semicolon.

Hope this helped :slight_smile:


Thanks for your help. I fixed it, but am still getting a "Syntax error" message.


Could you please post a screenshot of your code and the error message?


I just notice what's wrong, it appears that you forgot to close your function as well. Don't forget the semicolon at the end too.


I got it now. Thanks so much!


NP, I'm always glad to help :slight_smile:


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