Function does not return the result


Although I did it correctly I stil get an error claiming my function does not return 'The result is a tie!'. Any suggestions on how to fix it?

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


You're supposed to leave the first part of the code commented. It's there for later. The function that you wrote for this section is correct.


Having the same issue, the code is left commented out and its still telling me 'Oops, try again.
Your compare function does not return 'The result is a tie!' when there is a tie.'
What gives?

Edit: Scratch that, was missing the '!' at the end.


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