Rock, Paper, Scissors. Slide 7


#1


var compare = function(choice1 , choice2){
    if(choice1 === choice2){
      
     return "The result is a tie!";
       
    }
    else if(choice2 === "scissors"){
        
        return "rock wins";
        }
        else{
            return "paper wins";
        }
    else if(choice1 === "paper"){
        if(choice1 === "rock"){
            return "paper wins";
            }
            else{
                return "scissors wins";
                }
        
        }
}

I don't know what is wrong or how I could fix the problem.

Solved by @stetim94

Spoiler:eyeglasses:

`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";
            }
    }
else if(choice1 === "paper"){
    if(choice2 === "rock"){
        return "paper wins";
        }
        else{
            return "scissors wins";
            }
    }

};`


#2

the problem is actually here:

else if(choice2 === "scissors"){
        
        return "rock wins";
        }
        else{
            return "paper wins";
        }

this doesn't match with what you build in the previous exercise

you should check (using else if) if choice1 might be rock, then inside else if nest if and else to determine if user or computer won if user chose rock


#3