@Ayoubrabiae
Posted
Hi Anis Bacha,
I've reviewed your code and the preview, and it's evident that you're doing some fantastic work. However, there's a small issue in your calculation. When I tried to calculate my age, I noticed that it's higher than I expected.
Upon examining your code, I found that you're using new Date().getMonth()
to retrieve the month. This is correct, but it's important to note that this function returns the months starting from 0, not 1. For instance, in October, it should return 10, but it actually returns 9. To correct this, you should add 1 to the result you get from it.
Additionally, you're using new Date().getDay()
to obtain the day of the month. However, this function returns the day of the week. To get the day of the month, you should use new Date().getDate()
.
That's all for now. Keep up the great work, and if you need any assistance, I'm here to help. Happy coding!
Marked as helpful
@AnisBacha
Posted
@Ayoubrabiae I didn't notice this issue while working on the challenge, I will implement the necessary adjustments as suggested by you, Thank you for your feedback!