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


#1


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.


#2

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:


#3

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


#4

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


#5

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.


#6

I got it now. Thanks so much!


#7

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


#8

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