5/9 "The Result is a tie" is not showing up even though the code is the same as the help code


#1

/*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";
}
};

When I run it tells me that my compare function does not return with The result is a tie. Also it does not show up on the console.
Need help ;-;


#2

it does not show up on the console because you have not called the function you would have to call the function and pass it an argument(token) to console.log() to see it on the console like this

var userChoice = prompt("Do you choose rock, paper or scissors?").toLowerCase();
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!";}
                else                     {return "not a match";}
};

console.log(compare(userChoice, computerChoice));

#3

I add that code and it ended up saying userChoice is not defined in the console


#4

I added that code and it told me that userChoice is not defined in the console.


#5

Yeah it should work
Test it here


#6

look at 1 row. get (/*) sustitute with //