Rock paper scissors help

I was wondering what I did wrong because I did not receive any syntax errors, but my code wouldn’t print anything onto the screen. Here is a link to the project: https://www.codecademy.com/courses/introduction-to-javascript/projects/rock-paper-scissors-javascript?action=resume_content_item.
Here is my code:

const userInput = 'paper';

const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
};



 if (userInput === 'rock'|| userInput === 'paper' || userInput === 'scissors') {
   return userInput;
 } else {
   console.log('error');
 }

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

function determineWinner(userChoice, computerChoice) {
  if (userChoice === computerChoice) {
    return 'Tie Game!';
  }
  if (userChoice === 'rock'){
    if (computerChoice === 'paper') {
      return 'You Lost :(';
    } else {
      return 'You Won :)';
    }
  }
  if (userChoice === 'paper') {
    if (computerChoice === 'scissors') {
      return 'You Lost :(';
    } else {
      return 'You Won :)';
    }
  }
  if (userChoice === 'scissors') {
    if (computerChoice === 'rock') {
      return 'You Lost :(';
    } else {
      return 'You Won :)'
    }
  } 
}

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

playGame();

Hello, @mega0503042920.

Welcome to the forums.

Take a close look at this portion of your code, and my added comments.

Also, please review How do I format code in my posts? for future reference.

Happy coding!

1 Like

Very much appreciated! Thank You!!

1 Like