Choice 1 === Choice 2, I get it works, But I don't know why


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

var compare = function(choice1, choice2)
{
if (choice1 === choice2)
{
console.log( “The result is a tie!”);
while (choice1 === choice2)
{
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = “rock”;
} else if(computerChoice <= 0.67) {
computerChoice = “paper”;
} else {
computerChoice = “scissors”;
}

    var userChoice = prompt("Do you choose rock, paper or scissors?");
    console.log("Computer: " + computerChoice);
   return compare(userChoice, computerChoice);
    break;
   }
}

If i remove the return, my code will not works correctly. Can anyone explain the reason why?

<do not remove the three backticks above>

#2

Compare is a function. Although you have created the function at var compare = function..., that function has to be called. Your return statement is calling the compare function with choice1 equaling the variable userChoice and choice2 as computerChoice. It then returns the result.