6. what if choice1 is rock? HELP


#1



https://www.codecademy.com/pt-BR/courses/javascript-beginner-pt-BR-p2d9e/1/2?curriculum_id=5355c2d8516bcbd912000009#


I don't know what is wrong with my code
keep giving me syntaxerror: unexpected token else


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


#2

your else if should be in the function, it is not:

return "The result is a tie!" }; /* closes if */
}; /* closes function */
else if ... /* not inside the function */

#3

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

changed to this and still the syntx error :frowning:


#4

solved! i wass missing one }

thank you!