What if choice1 is rock?


#1

I need help it says "Syntax error: illegal return statement" I need help plz!!!

current 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

You closed your function too fast, put it after the last else statement.


#3

What do I do?


#4

function compare (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";
    }
}

}