Syntax Error on What if choice1 is paper exercise


#1


Hello there, I am stuck on this exercise and can't seem to find the error. This has been a tough exercise and it's confusing me so badly. Thanks for the help. I appreciate it.

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


Syntax error: Unexpected Token else


if (choice1 === choice2) {
    return "The result is a tie!" }
}
else if (choice1 === "paper") {
    if (choice2 ==="rock"){
        return "paper wins";
    }
    else { "scissors wins"
    }
}


#2

A good reason to write closing braces on their own line is to make this error easy to spot. The second closing brace is closing the function body, excluding the rest of the code.


#3

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