Feedback wanted: rock paper scissors solution


Hello! :grinning: I’d like feedback on my rock paper scissors solution. Cheers. :grin:


Hey @dsmchen

Good job. It’s mostly pretty good code but there is one obvious place where there is some unnecessary code

 function playRound(playerSelection, computerSelection) {
            computerSelection = computerPlay();

Here you pass computerSelection in as an argument to the playRound function but then set computerSelection inside the function.

let computerSelection;
let playerSelection;
console.log(playRound(playerSelection, computerSelection)); 

Here you set computerSelection to nothing and then pass it as an argument. It’s code that isn’t required which should always be removed if possible.

Otherwise great job and good luck with the future projects.


Thanks! I’ve updated the code. :smile: Anything else?


You now seem to do the same thing with playerSelection.

It might be better to just call playRound with no arguments and then within the function set playerSelection and computerSelection. You might usually not do this because passing in arguments allows you to make changes more easily but in this case you can be confident with the information you have that the playRound function won’t need to change.