Getting results but also getting error: Oops, try again, Make sure to call your compare function


#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);
console.log("User: " + userChoice);
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";
}
}
else if(choice1 === "scissors")
{
if(choice2 === "rock")
{
return "rock wins";
}
else
{
return "scissors wins";
}
}
}
console.log(compare(computerChoice, userChoice));


#2

Get rid of the last Console.log statement. Doing a function inside of a function won't work. Make it look like this.

compare(computerChoice, userChoice);

#3

Doing this results in the same thing. Getting rid of it completely results in no results and the same error. Not sure what you mean by "Doing a function inside of a function". Isn't this the call statement? Also, it is placed outside of the function at the very end of the code.