Rock/Paper/Scissors code not printing to console log


#1

Been working on this for a bit, and after starting over several times, i am either replicating my error over and over, or not seeing a higher order. Saw other responses, and while helpful, did not solve my issues.


#2

You again! :slight_smile: :slight_smile:

Only kidding… great use of the Q&A Forum! :slight_smile:

But don't forget, as a Pro subscriber you also have access to Advisors that can give you 1:1 advice in real-time :slight_smile: Saves having to wait for someone to respond on the forum!

Back to your code…

Re-organize it so you have 3 helper functions, 1 main function which will call the other 3 functions, and then one single line of code at the end which calls the main function.

Something like:

function getUserChoice(){};
function getComputerChoice(){};
function determineWinner(){};

function playGame(){};

playGame();

Then:

[ 1 ] Take a second look at your initial getUserChoice function. At the moment, you're not prompting the user for rock, paper, or scissors. Neither are you checking to see if they if inputted one of those three words.

[ 2 ] In the second function, getComputerChoice, you need to declare a variable called randomNumber which will hold the value of Math.floor(Math.random()*3).

The rest of the logic and syntax of the program looks fine :slight_smile: