tip-calculator sass and debounce function
Design comparison
Solution retrospective
I tried to make JavaScript code really easy to read. Beast I could. Please tell me how I did. Many thanks :-)
Community feedback
- @oliveridsPosted about 3 years ago
Hey, your code is really neat and works just great!
I'd suggest using the "input" event instead of "keyup" if you want a more imediate trigger, but that's not necessary if you don't want it.
Also, for better usability, I suggest not letting the calculator do its thing until the person types the number of people. Your code says that when the value of the input is zero, to use "1" as default value. However, a random user can't see that, and they might think there's an error. I think something like this would be enough for you:
if (input.value.length) { ..function.. }
Nice job!!
Marked as helpful0@VladimirBrscicPosted about 3 years ago@oliverids Thanks a lot for your suggestions!
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