tip-calculator

Please log in to post a comment
Log in with GitHubCommunity feedback
- @yacineKahlerras
Hi @roadblock37 just read your code and its excellent ! love that you commented it pretty well and I didn't have a hard time understanding it at all, well done. I just have a few suggestions that might be helpful
- in the custom tip event listener you should get the latest
radioChecked
from the dom
const radioChecked = document.querySelector("input[name='option']:checked") // uncheck tip percentage if there is a custom amount input if (radioChecked){ radioChecked.checked = false; }
otherwise it will only get the
radiochecked
from when the page was first loaded (which is 5%).- in the
computeTip
the math side of it should be :
perPersonTip = ( bill * (tip/100) ) / numPeople totalAmountPerPerson = (bill / numPeople) + perPersonTip
otherwise good job on the challenge and happy coding !
Marked as helpful - in the custom tip event listener you should get the latest
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