# Leap year determination in JavaScript

Using the tricks we've learned so far, we can easily determine if any year is a leap year or not: we just need to know how many days are in February. For this we need to take the zero day of March:

`let date = new Date(2020, 2, 0); console.log(date.getDate()); // shows 29, because 2020 is a leap year`

Let's improve our code so that the year type is displayed as text:

`let date = new Date(2020, 2, 0); if (date.getDate() == 29) { console.log('a leap year'); } else { console.log('not a leap year'); }`

Make the function `isLeap` that takes a year as a parameter and returns `true` if it's a leap year, and `false` otherwise.

← →
↑
en ru