On day two of my coding journey, I decided to finish a Rock Paper Scissors project on Code Academy.
To make things interesting I didn't use any tips and I wrote down each challenge I faced during the project's duration.
Didn't know how to start the project. Didn't know what route to
take that makes the user choose three options.
The route I took: I created a function with three parameters (Rock, Paper, Scissors);
Solution: Created an arrow function with one parameter called UserInput.
The else statement was returning as undefined when called.
Solution: add a return statement and remove the console.log
Reminder: Always use return because console.log has no return value.
The instructions on question 8 had me confused in terms of the else statement. I didn't know what to write after the return in the else statement block.
Solution: return 'You Won' (Because if the computer didn't choose paper then that means you might have).
The logic for determining the winner is returning as undefined when the function is invoked.
Solution: Test each of the statements separately and see if it works or returns undefined.
The play game function is always showing tie game regardless of the user and player choices
Solution: console.log the determined winner function but put the variables that hold the user choice and ComputerChoice as parameters.