Rock-Paper-scissors using Sass, BEM, vanilla js
Design comparison
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
Community feedback
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