Start learning free

LESSON 94 OF 677 · CONDITIONAL STATEMENTS - CHALLENGES

Leap Year

Practice

A leap year happens every four years, so it's a year that is perfectly divisible by four.

However, if the year is a multiple of 100 (1800, 1900, etc), the year must be divisible by 400 to be leap.

Write a function that determines if the year is a leap year or not.

Examples:

isLeapYear(2020) ➞ true

isLeapYear(2021) ➞ false

isLeapYear(1968) ➞ true

isLeapYear(1900) ➞ false

Video Solution:

STEP 1 OF 4
    Ctrl + Enter to check