Rock Paper Scissor
React.js
medium
30 mins
Things to do
- Choose between Rock, Paper, or Scissors.
- Computer randomly chooses one of the three options.(rock, paper, or scissor)
- Determine the result as:
- Rock beats Scissors
- Scissors beats Paper
- Paper beats Rock
- Default result should be "Press Any One"
- Show the winner as (You Win, You Lose, It’s a Tie).
- Maintain and display both Player and Computer scores.
- By default the score should be 0 for both the player and computer
- Add a Reset button to restart the game and reset the scores.
- After reset all states (choices, scores, and result) should return to their default values.
Instructions
Please use the following data-testid attributes in your React component:
btn-rock→ for the Rock Buttonbtn-paper→ for the Paper Buttonbtn-scissor→ for the Scissor Buttonplayer-choice→ for the Player Choicecomputer-choice→ for the Computer Choiceresult→ for the Resultplayer-score→ for the Player Scorecomputer-score→ for the Computer Scorereset→ for the Reset Button
Preview what you need to build
Solve Similar questions 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
