Design comparison
Solution retrospective
I think the javascript part could be done in a more simple way.
Community feedback
- @tinuolaPosted over 1 year ago
@Erick, Good job with the functionality.
A recommendation to make the JavaScript simpler (or more functional) is to consider breaking up the three logical checks/operations into separate functions that are then called by the event listener. Currently, all that logic inside the event listener can be confusing to read.
Also, the logic used to validate the required inputs (day, month, year) is the same; therefore it can be refactored into a single function. Consider giving the inputs a shared class and use a forEach loop to add an event listener that calls the function when the fields get a value.
You might be able to use a similar approach with other areas of the code that are running repetitive logic.
Marked as helpful1@Melchor16Posted over 1 year agoHey @tinuola , thank you for the feedback! you're right mi logic is repetitive and I should break it up in functions, I'm going to have your recommendations in mind for the next challenge.
1
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