6/9 what’s wrong? i checked many times but i dont know the error


#1

Why the code doesn't work.
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

This code works fine. What is the error message?


#3

maybe it was a bug of the editor.thanks for reply


#4

I'm having the same problem. Maybe a bug?


#5

Could you tell what the Kind of error message was? Often refreshing the page helps if there is no real error in your code. Happens from time to time that stuff gets stuck in the memory that effects the next run as well and by refreshing the page you reset it.


#6

I'm having the same problem. I'm receiving the message: SyntaxError: Unexpected end of input.

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

}


#7

Seems like you forgot to close your function by a } at the last line.