Design comparison
SolutionDesign
Community feedback
- @andreich1980Posted over 2 years ago
Hi Nadine
I have a few recommendations for your code:
- game.js
You don't need
else
in there since everyif
returns something. And there's a trick to check who wins: you can add an array of choices that win for each choice or have a separate object of winners:{ [CHOISES.ROCK]: [CHOICES.PAPER], <the choice>: [<choices that are defeated by the choice>], }
The you decide the winner using includes.
In the
computer-turn.jsx
you have a nested ternary operator formessage
. It looks weird and very hard to understand.Other than that everything looks good and is very close to the design! Good job
Marked as helpful1 - game.js
You don't need
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord