# Finding the last day of the month in JavaScript

We use the automatic date correction we learned earlier to easily solve our problem. After all, in JavaScript, the last day of the month is the zeroth day of the next month.

For example, let's define the number of days in March `2020`. To do this, when creating an object with a date, specify the zero day of April (it has the number `3`, since the numbering of months starts from zero):

`let date = new Date(2020, 3, 0); console.log(date.getDate());`

Make this way of solving the problem in the form of a function that will take the month and year as parameters and return the number of the last day of this month.

Determine what day of the week will be on the last day of the fifth month of `2025`.

← →
↑
en ru