DEV Community

Cover image for 100 Days Of Code | Day 2
Scott Kristopff
Scott Kristopff

Posted on

100 Days Of Code | Day 2

Hello Everyone,

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.

Challenges

Challenge (1)

Didn't know how to start the project. Didn't know what route to

take that makes the user choose three options.

Challenge (2)

The route I took: I created a function with three parameters (Rock, Paper, Scissors);

Solution: Created an arrow function with one parameter called UserInput.

Challenge (3)

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.

Challenge(4)

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).

Challenge(5)

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.

Challenge(6)

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.

Top comments (0)