Syntax error somewhere..help?


#1

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
var choice1 = userChoice, choice2 = computerChoice;

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(choice1, choice2);


#2

No semicolons after in conditional statements:


#3

@dhunter90,
and in addition to @haxor789 comments,
your return should be
a string Value "The result is a tie!" ( with capital T and an exlamation-! mark at the end )

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

  • the creation of the compare function ( required return-strings )
  • the build of the IF ELSE-IF Statement structure.

#4

@leonhard_wettengmx_n Thanks for the help!! didn't notice that!!


#5

Thanks again!! taking those out