Need help on step 7


#1

this is the error I'm getting when I submit: Your code returned 'paper wins' instead of 'scissors wins' when the inputs are paper and scissors.

Except I have scissors in my code? not sure what i'm missing.

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"; //this is where I have scissors listed
        }
    }
};

7. What if choice1 is paper? SyntaxError: Unexpected token else
#2

= means assignment not compare (== or ===). And assignments have the value you assign so in this case "rock" and non-empty strings in conditions are treated as "truthy":
http://www.sitepoint.com/javascript-truthy-falsy/

So you pick "paper wins" even though this might not be appropriate for paper vs scissors.