Hi @huyphan2210, good job completing this challenge!
Your code looks great, and I can see that you put a lot of effort into it. I especially like how you handled the input validation and error cases.
One suggestion I have is to add an event listener to trigger the calculateAge()
function whenever the enter key is pressed in one of the input fields. You can do this by modifying your handleFocusOut()
function like this:
// Add event listener to trigger calculateAge() on enter key press
e.currentTarget.addEventListener("keydown", (event) => {
if (event.keyCode === 13) {
calculateAge();
}
});
Overall, great work, and keep up the good coding! 😄
Marked as helpful
@huyphan2210
Posted
@gabrielmorandi Hey! Thank you for checking my code. I really appreciate it. 😁