Function does not return the result


#1

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/1?curriculum_id=506324b3a7dffd00020bf661#

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


#2

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.


#3

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.


#4

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