Can't figure out part six of rock paper scissors!


#1



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


It is telling me, "SyntaxError: Illegal return statement"


Replace this line with your code. 
var compare = function(choice1, choice2) {
    if (choice1 === choice2) { return ( "The result is a tie!" );
}
}
if(choice1 === choice2) {
    return "The result is a tie";
}

else if(choice1 === "rock") {

    if(choice2 === "scissors") {
        return "rock wins";
    }
    else {
        return "paper wins";
    }

}


#2

It's throwing you SyntaxError exception, because you ended your function too early. Reformat your code.

var compare = function(choice1, choice2) {
    if (choice1 === choice2) {
        return ("The result is a tie!");
    }
} // your function ends here
if (choice1 === choice2) {
    return "The result is a tie"; // return can only be placed in function
} else if (choice1 === "rock") {

    if (choice2 === "scissors") {
        return "rock wins";
    } else {
        return "paper wins";
    }

}

Also, it is not mandatory to use parentheses in return statement.