@cdanderson76
Posted
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 helpful