Calling compare function incorrectly


#1



What if choice1 is scissors?


Make sure to call your compare function with userChoice and computerChoice as the arguments!


var compare=function(choice1,choice2)
{if (choice1===choice2)
return "The result is a tie!"
else if ( choice1==="rock")
{ if( choice2==="scissors")
 {return "rock wins";}
 else 
 {return"paper wins";}}
 else if (choice1==="paper")
{if (choice2==="rock")
 {return "paper wins";}
 else {return "scissors wins"}}
 else if (choice1==="scissors")
 { if (choice2==="rock")
  {return "rock wins";}
  else {return "scissors wins"}}}
 compare("paper","scissors")


#2

Hi you should call your function compare with userChoice and computerChoice


#3

Please provide a syntax example how should I call that function..just an example by taking any random choice of userChoice and computerChoice


#4

can you post all your code?


#5

Okay sorry..got it..I was just doing blunder..by putting in value of user choice like compare("rock",computerChoice)...Now i got it I had to put userChoice instead of rcok..It happens..my bad