JavaScript Rock Paper Scissors Game explanation

Could someone please explain the determineWinner() and playGame() functions from the JS Rock Paper Scissors game?

JavaScript-Rock Paper Scissors

I don’t understand what it is the purpose of the playGame() function, since the game seems to work by simply writing the determineWinner() and calling it.


function determineWinner(userChoice, computerChoice) {
  if (userChoice === computerChoice) {
    return 'Game tie';
  }
  if (userChoice === 'rock') {
    if (computerChoice === 'paper') {
      return 'computer won';
    }
    else {
      return 'user won';
    }
  }
  if (userChoice === 'paper') {
    if (computerChoice === 'scissors') {
      return 'computer won';
    }
    else {
      return 'user won';
    }
  }
  if (userChoice === 'scissors') {
    if (computerChoice === 'rock') {
      return 'computer won';
    }
    else {
      return 'user won';
    }
  }
}

console.log(determineWinner('paper', 'rock')); //returns 'user won' 
console.log(determineWinner('rock', 'rock')); //returns 'game tie' 
console.log(determineWinner('paper', 'scissors')); //returns 'computer won' 

const playGame = () => {
    let userChoice = getUserChoice('rock');
    const computerChoice = getComputerChoice();
  console.log('You threw: ' + userChoice);
    console.log('The computer threw: ' + computerChoice);
  		console.log(determineWinner(userChoice,computerChoice));
}
playGame();