Design comparison
SolutionDesign
Solution retrospective
Hello everyone , I chose the bonus version of this challenge and I built it only with vanilla Javascript, I don't recommond doing it this way , using a framework or a library would be very helpful. I still have some issues with the mobile version and the JS code is kind of long any ideas on how to solve that are very appreciative Thank you in advance
Community feedback
- @fazzaamiarsoPosted over 2 years ago
Hello Wissem! Nice solution!
I have some improvements.
- You can refactor the restart logic to a function as both winning and losing do the same thing.
function restart() { // your restart logic } document.getElementById("Restart-winning").addEventListener("click", restart); document.getElementById("Restart-losing").addEventListener("click", restart);
- You should prefer to use
let
andconst
thanvar
. By usingvar
means your variable is always global and not scoped.
I hope it helps! Cheers!
0
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