Why is the value of the finalResult undefined in the console?


This is my code:

 function displayWinner() {
           let finalResult;
            if (computerScore > playerScore) {
                finalResult = "You Lost! Better luck next time";

             else if (computerScore < playerScore) {
                finalResult = "Congratulations, You Won!";

             else {
                finalResult = "It'\s a tie";

            return console.log(finalResult);

at the second last line I am returning the value of finalResult in console. I get the desired output but below the console.log message i get undefined.

Sorry for bad formatting. This is my first time asking a question.


the function console.log returns undefined. That is why you see it.