Code 6. What if choice1 is rock? I can't solve the problem


#1

Your code returned 'The result is a tie' instead of 'paper wins' when the inputs are rock and paper


var compare = function(choice1, choice2) { 
    if (choice1 === choice1) {
         return "The result is a tie"; 
   
    }
   
    else if(choice1 === "Paper") {
    
        if(choice2 === "Rock") {
            return "Paper wins";
        }
        else {
            return "Scissors wins";
        }
    }
};
compare("Paper", "Rock");


#2

Why do you compare choice1 with choice1?
Change it and you will go on :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.