6. Always returns result is a tie


#1

No matter what I enter compare() returns "the result is a tie!"
No idea why, would appreciate any help.

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} 

console.log("Computer: " + computerChoice);
console.log("User: " + userChoice);

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

}       

console.log(compare())

#2

Ah got it. Didn't notice I used the wrong operator to assign choice1 and choice to comp and userChoice.


#3

you should call like this:
compare(userChoice,computerChoice)

any question?
@rkdownie12gmail.com