Design comparison
Solution retrospective
Any feedback to improve efficiency with js is appreciated
Community feedback
- @Isma1306Posted over 2 years ago
Great job, I like your code it is easy to read and follow. I could just tell you to add some logic to prevent the form to be submitted if you didn't select any rating. Right now if you just press submit you will get to the thanks page and it will say "You selected undefined out of 5" you can just wrap the logic inside the submitButtons callback function with an 'if (rating)' to prevent this behavior. Don't forget to leave outside the preventDefault!
Another good practice is using a IIFE to wrap your logic and prevent pollution, I will leave you the MDN doc to give you a good explanation https://developer.mozilla.org/en-US/docs/Glossary/IIFE . This is not necessary at all but it is a good idea to know about it.
I hope this help you, enjoy!
Marked as helpful1@cwu90Posted over 2 years ago@Isma1306 Thank you so much for taking the time to read my code! I implemented the changes you suggested. It was very helpful. Much appreciated!
1@Isma1306Posted over 2 years ago@cwu90 you are welcome! enjoy your journey! and remember to upvote my answer if you feel like it was helpful for you!
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