It saying im not returning "Its a tie" but when i put return in it says the same thing


#1

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(userChoice, computerChoice)
{
if (userChoice === computerChoice)
{
console.log("The result is a tie");
}
else{
if (userChoice < computerChoice)
{
console.log( "Computer Wins");
}
else(userChoice > computerChoice)
{
console.log("You Win");
}}};


#2

@boardrunner71238,

The exercise is based on you using the return statement.
AFTER your IF statement they want you to use an ELSE-IF

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

  • the creation of the compare function
  • the truth-table
  • the build of the IF ELSE-IF statement structure as part of the compare FUNCTION-BODY
  • the execution of the compare function (keeping in mind that the return statement is used )