What's wrong?


#1

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:


#2

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


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

Please read
http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b
and concentrate on

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

#4

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

Thank you :grin:


#5

Thank you :grinning: