What if choice1 is rock


#1

I couldn't find where the problem is

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

a function has curly brackets ({}) to indicate the start and end of a function:

var example = function(){
  // do something
}

which are missing in your case


#3

I added but console gives "SyntaxError: Unexpected identifier"


#4

if you then add an updated version of your code, so i can see what you did...


#5

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

}
}


#6

the moment you want to return a string (for example paper wins) make sure to use quotation marks (") so javascript knows it is dealing with a string


#7

many thanks and sorry for bothering for such a little mistake I've missed