Rock, paper, scissor 5. "compare function doesn't return tie", why is this wrong?


#1

this is my code

var compare = function (choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie";
}
};

what am i doing wrong?


#2

@grandmapants,
Your return-statement
should return "The result is a tie!" ( with an exclamation mark )

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 )

#3

wow, i have been banging my head against the wall, trying to figure out why my code wasn't working, and it was that stupid exclamation mark. good eye, thanks for your help!