Okay. This has been driving me nuts for a while ( 4 days ), so i created a function called computerPlay that will randomly return either ‘Rock’, ‘Paper’ or ‘Scissors’. I also created a function that plays one round that takes two parameters - the playerSelection and computerSelection. I also created a function that prompts the user to enter their selection ( not sure if thats what i was supposed to do. But if i console.log(playRound(playerSelection(), computerPlay())) It works fine, but i am feeling unsure if i am doing this correctly. This might sound dumb but in the picture below in the assignment i see const playerSelection = 'rock", whats up with that?
Also i see const computerSelection = computerPlay();
( i kinda understand this, so could i use my prompt like so?
let userChoice = playerSelection():
let computerSelection = computerPlay():
and pass these variables/arguements into the function of playRound? i.e playRound(userChoice, computerSelection) to run a single round?
Then i see console.log(playRound(playerSelection, computerSelection))
Why are they passing the argue of rock into playerSelection? i get the computerSelection part, it runs the function to get a random rock paper or scissors for the computer.
Also step 5, it asks to run a game for 5 rounds and keep score, im guessing we have to use loops for this, but we havent learned about those yet, they are actually the next lesson. If anyone could help that would be great and any tips would greatly be appreciated. This has me at my wits end. If i am unclear, please accept my apologies, this has kinda deflated my learning a bit, and i feel very stuck, but i hope i can get some help in solving this issue to move on.
Here is a link to my code in codepen.