Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Age Calculator with Vanilla JS

Danielle 160

@dfeeney96

Desktop design screenshot for the Age calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


I would like to know if there are any parts of my code (particularly the JS) that I could improve on. Are there any best practices I have missed or ways to make my code more readable / efficient?

Thank you!

Community feedback

@arberlisaj

Posted

Hi @danielle I would like to congratulate you on completing the Age Calculator App and I might have a couple quick solutions for your questions

  • Instead of declaring constant variables like this: const dayLabel = day; const monthLabel = month; etc. You want to declare them like this const dayLabel = day , monthLabel = month , yearLabel = year;
  • I see you use function keyword inside methods for an instance forEach(function(monthOfYear) it would've been a lot better if you used arrow like this monthsOfYear.forEach(m=> if(m.month === selectedMonth) // return something)

All in all good solution and it would be a lot better if you remove the designe directory from you github repo as it is just a liability and it takes space for no good purpose

Happy Coding :)

Marked as helpful

1

Danielle 160

@dfeeney96

Posted

Thank you for your feedback @arberLisaj ! Some great points

1

Please log in to post a comment

Log in with GitHub
Discord logo

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