Function isLeapYear

  • Checks if a given year is a leap year. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.

    Parameters

    • year: number

      The year to check. Must be a valid year number.

    Returns boolean

    true if the year is a leap year, false otherwise.

    Throws

    Will throw an error if the year is not a valid number.

    Example

    isLeapYear(2000); ;
    //=> true
    isLeapYear(2001); ;
    //=> false

Generated using TypeDoc