JAVASCRIPT - Rock, Paper, or Scissors - keep getting undefined results

Hey,
I’ve been following the exercise video as I code and I thought I had coded everything the same, but I keep returning undefined values when I execute the code with console.log and I just don’t see why?
I’d appreciate any help and explanation.

thanks

const getUserChoice = userInput => 
{
 userInput = 
userInput.toLowerCase();
if (userInput === 'rock' || userInput === 'scissors' || userInput === 'paper') {
  return userInput;
} else {
  console.log('Error, please type: rock, paper or scissors.');
   }
}  

const getComputerChoice = () =>{
  
  const randomNumber = Math.floor(Math.random() * 3);
  switch (randomNumber){
    case 0:
      return 'rock';
    case 1:
      return 'paper';
    case 2:
      return 'scissors';
  }
 };

const determineWinner = (userChoice, computerChoice) => {
  if (userChoice === computerChoice) {
   return ' This game is a tie!'; 
  }
  if (userChoice === 'rock') {
    if (computerChoice === 'paper') {
      return "Sorry, computer won!";
    } else {
      return "Congratulations, you won!";
    }
  }

  if (userChoice === 'paper') {
    if (computerChoice === 'scissors') {
      return "Sorry, computer won!";
    } else {
      return "Congratulations, you won!";
    }
  }

  if (userChoice === 'scissors') {
    if (computerChoice === 'rock') {
      return "Sorry, computer won!";
    } else {
      return "Congratulations, you won!";
    }
  }
};

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

I think you should be passing that function 2 arguments (2 strings), but instead you’re just passing one string consisting of two words separated by commas. I believe the right way would be like this: determineWinner(‘rock’, ‘scissors’)

Hope this helped :slightly_smiling_face:

Thanks that’s exactly what was wrong