Rock Paper Scissors pro exercise

Hey everybody. I was doing the Rock, Paper, Scissor exercise and I watched the walk through and all the hints and my code isn’t working. My code is below! If anyone could help me out that would be great.

const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if(userInput === ‘rock’ || userInput === ‘paper’ ||userInput === ‘scissors’){
console.log(userInput);
}
else{
console.log(‘The ■■■■ how did you mess this up?’);
}
};

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 ‘Its a tie chuckleheads’;
}
if(userChoice === ‘rock’){
if(computerChoice === ‘paper’){
return ‘The computer won! Goshdarn AI!’
}
else {
return ‘The user won!! YAY goodbye Ultron!’;
}
}

if(userChoice === ‘paper’){
if(computerChoice === ‘rock’){
return ‘The user won! This means the computers will not take our jobs!’;
}
else{
return ‘The computer won! Goodbye freedom…’;
}

}
if(userChoice === ‘scissors’){
if(computerChoice === ‘paper’){
return ‘User won! Mankind prevails’;
}
else{
return ‘Computer won. Goodbye earth, hello ■■■■’;
}
}

}

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();

End of Code. Thanks a lot for your help

Hey @ajax5680793576 thanks for sharing! :slight_smile:

Can you highlight your code and format it with the </> button? It’ll be easier to troubleshoot.

One thing you want to figure out before anything else is, what is working and what is not?
When following with video, after every mini-segment, you want to make sure that you’re testing whether things are working like you expect to or not. Not only will this help you prevent mistakes, but it will give you a richer experience and help you understand the mechanics better.

So what about your code isn’t working at the moment? Is it giving you output that you don’t expect, or is it throwing an error, if so, what type?

Nevermind I’ve got it fixed. Thanks for your help!