Rock Scissor Paper Project HELP

I have finished coding the rock scissor paper code, but when I input it and click run nothing happens. I am not getting any errors so not sure why the console remains blank. Did I miss something? Please help! Thank you

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

if (userInput === ‘rock’ || userInput === ‘paper’ || userInput ===‘scissors’) {
return userInput;
} else {
console.log(‘Error!’);
}
}

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 was a tie’;
}

if (userChoice === ‘rock’) {
if (computerChoice === ‘paper’) {
return ‘Computer Wins’;
} else {
return ‘Player Wins’;
}
}

if (userChoice === ‘paper’) {
if (computerChoice === ‘scissors’) {
return ‘Computer wins’;
} else {
return ‘Player Wins’;

}
}

if (userChoice === ‘scissors’) {
if (computerChoice === ‘rock’) {
return ‘computer wins’;
} else {
return ‘player wins’;
}
}

};

const playGame = () => {
const userChoice = getUserChoice(‘paper’);
const computerChoice = getComputerChoice();
console.log('I picked ’ + userChoice);
console.log('Computer picked ’ + computerChoice);
console.log(determineWinner(userChoice, computerChoice));

};

hi there! I’d love to help. Could you edit your post and make sure you encase all your code correctly so it’s easier to read? Thanks!

I am not sure how do that. I just copy and pasted my code directly from the javascript editor. I am getting no errors, but my console.log are not displaying any results just a empty screen.

I just took a super quick look at it. Did you forget to actually call playgame(); at the bottom of your code to get it started?

Looks like that was the error. Thanks for your help. Such a silly mistake after coding all that -_-

I knew where to look because I’ve made that mistake a bunch of times too, no worries :laughing:

Have a look at the following FAQ for posting code, it’s rather helpful-