Rock Paper Scissors output problems

Hi all, I have run into this issue that i really am not sure what it is as I haven’t found any posts about this.

I am completing the JavaScript project Rock Paper Scissors and my output is the exact log of my code instead of the functions being executed.

This is my code:

const getUserChoice = userInput => { userInput.toLowerCase(); if ( userInput === "rock" || userInput === "scissors" || userInput === "paper" ) { return userInput; } else { console.log("Error!"); } }; const getComputerChoice = () => { const randomNumber = Math.floor(Math.random() * 3); switch (randomNumber) { case 0: return "rock"; break; case 1: return "scissors"; break; case 2: return "paper"; break; } }; const determineWinner = (getUserChoice, getComputerChoice) => { if (getUserChoice === getComputerChoice) { return "tie"; } if (getUserChoice === "rock") { if (getComputerChoice === "paper") { return "computer won"; } else { return "you won"; } } if (getUserChoice === "paper") { if (getComputerChoice === "scissors") { return "you won"; } else { return "computer won"; } } if (getUserChoice === "scissors") { if (getComputerChoice === "rock") { return "computer won"; } else { return "you won"; } } }; const playGame = () => { const userChoice = getUserChoice("paper"); const computerChoice = getComputerChoice(); console.log("You formed a " + getUserChoice); console.log("Comuter formed a " + getComputerChoice); console.log(determineWinner(userChoice, computerChoice)); }; playGame();

Any help is appreciated, I’m sure this is a simple issue that i’m overlooking. Thank you!!

Lines 59 and 60 are correctly outputting their respective function bodies.

What you might wish to do is use the variables you created in lines 57 and 58.

2 Likes

Thanks so much! that was exactly my issue!

1 Like