Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 7 months ago

Rock, Paper, Scissors game

AlexCristea2007•840
@AlexCristea2007
A solution to the Rock, Paper, Scissors game challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I’m particularly proud of how the JavaScript code efficiently handles the entire game flow, from capturing user input to determining the winner and updating the score. The smooth interaction and seamless user experience, with the game’s immediate feedback and dynamic results, showcase the strength of the logic behind the code. It’s not just functional but also intuitive, making the game feel lively and engaging. Next time, I would optimize the code even further by breaking it into cleaner, more modular functions. This would not only improve maintainability but also make future updates easier to implement. I’d also focus on refining the event handling and adding more advanced features, like incorporating sound effects or custom animations, to take the overall experience to the next level.

What challenges did you encounter, and how did you overcome them?

One of the main challenges I encountered was managing the flow of the game in JavaScript, particularly handling the user's input and ensuring the correct outcomes were displayed in real-time. Initially, it was tricky to manage the interaction between multiple elements, such as updating the score, displaying results, and triggering animations, without causing delays or glitches. To overcome this, I focused on breaking down the code into smaller, manageable functions. This allowed me to handle different parts of the logic—like determining the winner, updating the score, and triggering animations—separately but in a synchronized way. I also used event listeners efficiently to ensure the game responded immediately to user actions. Testing each component step by step helped identify issues early, making it easier to debug and refine the code. Additionally, I leveraged JavaScript's asynchronous features, like timeouts for animation delays, to maintain a smooth flow without blocking the rest of the game.

What specific areas of your project would you like help with?

I would appreciate help with optimizing the JavaScript code, particularly in terms of structure and performance. I want to make the code more modular and reusable, as well as ensure it remains easy to maintain as I add more features. Additionally, guidance on enhancing event handling and improving the responsiveness of the game, especially on devices with lower performance, would be really valuable. Any suggestions for refining the logic to ensure it's even more efficient and bug-free would also be great!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on AlexCristea2007's solution.

Join 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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.