6.What if Choice is rock


#1

Please help!

I keep getting back Syntaxerror: unexpected end of input
Here is my 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";
}
)


#2

change the ) to } and add another }; on the end to complete the function.


#3

You have a parenthesis at the end instead of a curly bracket... You're also missing some other curly brackets.

here is your code formatted for easy reading:

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

As you can see the parenthesis at the end doesn't close anything. After you remove it, you'll have to add a closing curly for your first if statement and a curly to close your function.


#4

Pretty close not the if needs the } but the else if the rest is correct.