Build "Rock, Paper, Scissors": Both choices are the same!


I've been stuck at this part of "Rock, Paper, Scissors" for a VERY VERY long time. I've been searching through codecademy discuss forums, and still haven't found a solution. And have tried everything I can think of to get the problem right. But no luck so far. (U.U) But that's why I'm making this topic. :slight_smile:

The problem it says I'm having is:

I've been trying to figure out how to get the 'compare' function to work, but I have no idea of what to do(since none of the discussions had the right solution to this issue).

Here's my code:

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);

var compare = function(choice1, choice2) {
    if(choice1 === choice2) {
        return "The result is a tie";

Thank you all! ^ ^


I had the same struggle and could not believe my mistake:
Put an exclamation mark after" tie"


It worked! ~Thank you ^ ^


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