Https://www.codecademy.com/courses/introduction-to-javascript/projects/rock-paper-scissors-javascript

const getUserChoice = userInput => {
 userInput = userInput.toLowerCase(); 
  if (userInput === 'rock' ||userInput ==='paper' ||userInput ==='scissors'){
    return userInput;
  }else {
    console.log('This is real Error!!!');
  }
  
}
  getUserChoice();
function getComputerChoice(){
  Math.floor(Math.random(0,3));
  switch (randomNumber){
    case 0:
      return 'rock';
    case 1:
      return 'paper';
    case 2:
      return 'scissors';
       }
  }
 function determineWinner(userChoice,computerChoice){
if (userChoice === 'computerChoice');
   return 'The game is a tie!';
     }
if (userChoice === 'rock'){
  if(computerChoice ==='paper')
    return 'The Computer Won';
  } 
else {
  return 'You Won';
}
if (userChoice === 'paper'){
  if (computerChoice === 'scissors')
    return 'The Computer Won';
}else{
  return 'You won';
}
if (userChoice === 'scissors'){
  if (computerChoice === 'rock')
    return 'The Computer Won';
}else{
  return 'You won';
}
console.log(determineWinner('paper','scissors'));

please help me with my errors

Your if/else if/else statements are not all properly set up.

if (condition) { // opening bracket
   //do something
} // closing bracket
1 Like