JavaScript's rock paper scissors exercise

Goodevening, it’s my first time posting on a forum on the internet, I apologize for my clumsiness. I wanted to ask help for a this exercise, I pretty much followed the hints the exercise gave me, but when I get to step 11 to test the “determineWinner” function, i get triple outputs as “The computer won” plus “undefined”. Can anyone give it a look and tell me what’s wrong?

const getUserChoice = userInput => {

  userInput = userInput.toLowerCase();

  if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {

    return userInput;

  } else {

    console.log('Error!')

  }

};

const getComputerChoice = computerChoice => {

  let randomNumber = Math.floor(Math.random() * 3)

  switch (randomNumber) {

    case 0:

    return 'rock';

    break;

    case 1:

    return 'paper';

    break;

    case 2:

    return 'scissors';

    break;

    default:

    return 'Error!';

    break;

  }

};

function determineWinner(userChoice, computerChoice) {

  if (userChoice === computerChoice) {

    console.log('The game was a tie!');

  }

};

  if (userChoice === 'rock') {

    if (computerChoice === 'paper') {

      console.log('The computer won!');

    } else {

      console.log('You won!');

    }

  } 

  if (userChoice === 'paper') {

    if (computerChoice === 'scissors') {

      console.log('The computer won!');

    } else {

      console.log('You won!');

    }

  }

  if (userChoice === 'scissors') {

      if (computerChoice ==='rock') {

        console.log('The computer won!');

      } else {

        console.log('You won!');

      }

  };

  console.log(determineWinner('rock', 'paper'));

your determineWinner does not return anything, yet when you call the function you attempt to log the returned result, which results in undefined:

// logs undefined, given the function does not return anything
console.log(determineWinner('rock', 'paper'));

There are two possible options:

  1. make the determineWinner function return the result string
  2. remove the .log() when you call the function