Rock Paper Scissors keeps coming back undefined

Im trying to figure out why this keeps returning as undefined. Any ideas?

const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {
return userInput;
} else {
  console.log('YOU DUMMY');
}
}
function getComputerChoice(){
  Math.floor(Math.random() * 3);
}
switch (getComputerChoice) {
case 0 : ('rock')
break;
case 1 : ('paper')
break;
case 2 :('scissors')
break;
default: console.log('error')
}
console.log(getComputerChoice());
function determineWinner(userChoice,computerChoice){
if (userChoice === computerChoice) {
return console.log('tie') }
if (userChoice === 'rock'){
if (computerChoice === 'paper') {
  console.log('computer wins')
}
else {
  console.log('user wins')
}
}
if (userChoice === 'paper'){
if (computerChoice === 'scissors') {
  console.log('computer wins')
}
else {
  console.log('user wins')
}
}
if (userChoice === 'scissors'){
if (computerChoice === 'rock') {
  console.log('computer wins')
}
else {
  console.log('user wins')
}
}
}
const playGame = () => {
  const userChoice
  = getUserChoice('scissors');
  const computerChoice
  =getComputerChoice();
  console.log('You threw: ' + userChoice);
  console.log('the computer threw:' + computerChoice);
};
-

‘undefined’ is the stock return value of all JS functions. Take charge of your returns.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.