Leap Year In JavaScript

Leap Year

On this page

Leap Year

let year = 2025;
    // Define variable year and initialize value
    {
      if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        // three conditions to find leap year
        // The number which is divided by 4 or 400 is a leap year.
        // The number that divided by 100 is not zero is leap year
    
        console.log(year + " is leap year");
      } else {
        console.log(year + " is not leap year");
      }
    }
    

Output

2025 is not leap year