6. what if choice 1 is Rock please help


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/2?curriculum_id=506324b3a7dffd00020bf661#

Error:: SyntaxError: missing } after function body


if(choice1 === choice2) {
    return "The result is a tie";
    }
    else if (choice1 === "Rock") {
        if (choice2 === "Scissors") {
        return "Rock Wins!";
    }
        else {
            return "Paper Wins!"
        }
};


#2

If you used a function in your code then make sure you closed that at the end after closing else if


#3

Sorry for the late reply, let me copy & paste the whole complete 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!"
}
};

same error. but when I add an extra " } "at the end else it says "solved"


#4

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