Help with rock, paper, scissors exercise

I am having issues with the rock, paper, scissors exercise.

const getUserChoice = userInput => { userInput = userInput.toLowerCase(); if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') { return userInput} else { console.log('error') } } const getComputerChoice = () => { const randomNumbers = (Math.floor(Math.random()*3)); switch (randomNumbers) { case 0: return 'rock'; case 1: return 'paper'; case 2: return 'scissors'; } } const determineWinner = (userChoice, computerChoice) => { if (userChoice === computerChoice ) { return 'You tied!'; } if (userChoice === 'rock') { if(computerChoice === 'paper') { return 'You lose!'; } } else { return 'You won!'; } if (userChoice === 'paper') { if (computerChoice === 'scissors') { return 'You lose!'; } else { return 'You won!'; } } if (userChoice === 'scissors') { if (computerChoice === 'rock') { return 'You lose!'; } else { return 'You won!'; } } } const playGame = () => { const userChoice = getUserChoice('paper'); const computerChoice = getComputerChoice(); console.log('You threw:' + userChoice) console.log ('The computer threw:' + computerChoice) console.log(determineWinner(userChoice, computerChoice)) }; playGame()

My issue:
First, when I call the function with something like console.log(determineWinner(rock, scissors)); it gives me an error saying it is undefined.

Second, even when working correctly, sometimes it will say I won even though I should have lost (user chose paper and computer chose scissors). I have tried looking at the code and then following along with the video but it still gives me an error. I know something is wrong.

Finally, when creating a function, why is it that in some cases, I do not define parameters like :
const getComputerChoice = () =>

and in other cases I do as in :
const getUserChoice = userInput =>

I have many more questions but I think this will do for now…thanks!

If you want to call your function with hard coded arguments, you need to pass them in as strings:

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

Your scope is not correct:
The if statements for the case that userChoice is paper is in the if statement for userChoice===‘rock’ so it will never be reached.

Can you please clarify this?
Your scope is not correct:
The if statements for the case that userChoice is paper is in the if statement for userChoice===‘rock’ so it will never be reached.

if (userChoice === 'rock') {
  if (userChoice === 'paper') {
      if (computerChoice === 'scissors') {}
  }
}

I deleted some of your code so you can see what I mean.