Rock, Paper, Scissors

Hi! Could someone help me to resolve my errors? My code doesn’t seem to work :’(

const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’ || userInput === ‘bomb’) {
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 === ‘paper’) {
return “Sorry, computer won!”;
} else {
return “Congratulations, you won!”;
}
}
};

const playGame = () => {
const userChoice = userChoice(‘paper’);
const computerChoice = computerChoice();
console.log(‘You threw:’ + userChoice);
console.log(‘Computer threw:’ + computerChoice);
console.log(determineWinner(userChoice + computerChoice));
};

playGame()

Hi @java3201204159
In your playGame() function you assign the value userChoice('paper') to the variable userChoice. But there is no such function userChoice() . Instead you have a function getUserChoice() that expects a parameter userInput.
Same thing for computerChoice();
determineWinner() expects two arguments. In your last line of the function body playGame() you log

With userChoice + computerChoice you just pass one string.