Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

Rock-Paper-scissors using Sass, BEM, vanilla js

Matthew Van Pelt•575
@Mattvp21
A solution to the Rock, Paper, Scissors game challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi Everyone,

Happy New Year!

I'm finishing the new year strong building this game. I would really like some feedback on this one. I'm proud that I did this with very little help as my goal was to test myself and really figure things out on my own.

The way I decided to try and handle the javascript was to create a sequence of functions utilizing the steps provided in the description. Each of these functions utilize a setTimeout so the steps appear in order. In order to switch the screens, I had toggle functionality with inactive and active classes and created new elements based on the id I selected from the buttons(paper, rock, scissors). Selected the computer choice from an array and then compared them as needed.

I ran into two issues:

With the play again button, I did a page reload while holding the score in localStorage. Normally I would reset the values but I couldn't handle the new elements created through the setPlayersChoice and setComputerChoice functions.

In production, I had to redo the routing on my images on those created elements and submitting it without rendering the triangle.

If anyone can give me tips for the future, I greatly appreciate it.

Happy new year and happy coding!

Matt

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Matthew Van Pelt'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

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

Frontend Mentor

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

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