What's wrong?


This is my code I don;t understand why it errors "Your compare function does not return 'The result is a tie!' when there is a tie."

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random(0,1);
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";

I'll be glad if you guys help me! :grin:


Missing exclamation point at the end of your message, the rest seems to be ok.

you use
 "The result is a tie";
they ask
 "The result is a tie!";

Please read
and concentrate on

  • the build of the IF ELSE-IF statement structure
  • the required return-Values


[quote="haxor789, post:2, topic:7137"]

Thank you :grin:


Thank you :grinning: