What if choice 1 is rock: I can't seem to find the syntax error: end of input


#1



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

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";
    }
// missing } to close else if
// missing } to close function

see comments in code


#3

12 posts were split to a new topic: Choice1 is rock


#14

2 posts were split to a new topic: Choice1 is rock


#15

A post was merged into an existing topic: Choice1 is rock


#16