Design comparison
SolutionDesign
Solution retrospective
The only logic I couldn't implement is if a user input a day that was not on the month (ex. user input day = 31) and the month has only 30 days it will still calculate it and I couldn't find solutions for it.
Community feedback
- @Chanda-AbdulPosted over 1 year ago
👋🏾
To validate the day, you could use and array to store the days for each month. ex.
const daysPerMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
- and access each month by it's index. So if you wanted to see how many days were in the second month of the year(February), you could use
daysPerMonth[1]
which should be28
I hope that helps!
Marked as helpful1@Khalid-debuggPosted over 1 year ago@Chanda-Abdul Smart woman move, ofc u r not single.
0 - and access each month by it's index. So if you wanted to see how many days were in the second month of the year(February), you could use
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