Lesson 6 What if choice 1 is rock?


#1



Oops, try again. There was a problem with your syntax.


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

Hi this part you should add one } for closing the else if statement

    else if(choice1 === "rock") {
        if(choice2 === "scissors") {
            return "rock wins";
        }
        else {
            return "paper wins";
        }
    }//add this one for closing the else if statement
};

#3

Thank you !!11!:slight_smile:
I think i really need to pay attention to the brackets haha


#4

thank you very much, this helped me a lot. With your replies I've solved 3 problems already! Thanks m8!