5. Your compare function does not return 'The result is a tie!'


#1

I typed like that , But It's only show

Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie.

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

What's wrong with me ?


5. both choices are the same
#2

Hi
Instead

return "the result is a tie";

You should return

return 'The result is a tie!'

#3

Answer needs an exclamation point to pass; it's missing from the code in the hint.


#5

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

compare();

THERE SEEMS TO BE A BUG ON THIS ONE ! IT TELLS ME IT DOESNT DISPLAY THE RESULTS... BUT IT DOES


#6

Try to add a ! after tie like that

return "The result is a tie!";