What if choice1 is paper?


#1


Hey,


I have a problem and I can not find where it is, it is the exercise:
https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/3?curriculum_id=506324b3a7dffd00020bf661#


and the error message I get is:
SyntaxError: Unexpected token {


This is my code:

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


if anyone can help I would be grateful!


#2

Looks like you've got an extra ( :slight_smile:


#3

I do not believe! Almost an hour I was looking for the error ..
Thank you!


#4

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