Design comparison
Solution retrospective
Is it the shortest way to add these fonctionnalities to the website with js?
Community feedback
- @cdanderson76Posted 6 months ago
Nice work on the project, and I like what you did with the color there. I started off this project the same as you, and in the process, I learned a couple of things:
They always say write 'DRY' code: 'don't repeat yourself'. So while this works fine, there's a consistent repetition of the functions that you have there. Also, with extra '.html' file, there is an additional request sent to the 'server' to grab that page as well, which could cause performance issues .
You could use string template literals to make this work, and write out your code in JavaScript. Check out my code here: https://github.com/cdanderson76/interactiveRatingComponent/blob/main/script.js
See how it looks like HTML? That's what renders the second page. I hope that this helps!
Marked as helpful1
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