Both choices are the same!


#1

Hello friends,
I am strucked with the exercise of Both choices are the same. I have no clue of whats wrong with the code. It is printing the result The result is a tie along with that indicating Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie. please help

/*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 compare(choice1,choice2)
{
    if(choice1 == choice2)
    {
        return "The result is a tie";
      }

};
console.log(compare("rock","rock"));

#2

Try adding the exclamation point on the end of the string "The result is a tie!"


#3

It was a small mistake and i did not notice.Now corrected and working,Thanks


#4

OMG, thank you so much for mensioning that, I was so stuck on that even when I did it correctly!