I'm stucked


#1

I wrote the following code:

var compare = function (choice1, choice2) {
    if (choice1===choice2) {
        console.log("The result is a tie!");
        }
};
compare("paper","paper");

The result says "The result is a tie!" however, I get the following message:
"Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie."

What is wrong here?


#2

Ok maybe have a look at this post:

Meaning that setting choice1 and choice2 to 1 is not important as you're dealing with 2 different sets of variables.
If you want to try it you can run:

    var compare = function (choice1, choice2) {
        if (choice1===choice2) {
            console.log("The result is a tie!");
            }
    }
    compare(1,1);

And the real problem is:

"Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie."

The result should be returned not console.logged.


#3

Thank you for your reply.
I wrote the following:

var compare = function (choice1, choice2) {
if (choice1===choice2) {
console.log("The result is a tie!");
}
};
compare("paper","paper");

But I'm still getting the same output


#4

As said it needs to be return instead of console.log


#5

Got it. That worked. I didn't read that part