Interactive card details form

Solution retrospective
I really enjoyed doing this challenge.
I use Javascript Promise
for form validation. At first, I planned to write a simple function that returns true
if there are no invalid inputs, but the problem is that after running this function, I'll need to add another if-statement inside the submit event to check if the function returns true. And I think that's a redundant code.
With Promise, I could just resolve
it and pass the form data, or reject
it and pass the invalid inputs and prevent the form from submitting. Tho this project prevents the default form submit even if there's an invalid input. I had intended to create reusable form validation, and I believe this is an excellent example of why using Promise is better than my initial solution.
I'm not sure if I did everything correctly, so if you have any suggestions, don't go easy on me, It really helps. Thaaaanks <3
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on lieneil's solution.
Join 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