Detects if a given year is a leap year.

Type signature

(year: number) => boolean

Examples

leapYear(2020);
// ⇒ true
Try in REPL
leapYear(2019);
// ⇒ false
Try in REPL

Questions

  • How to find if the given year is a leap year?

TypeScript sourceJavaScript source