Leap year checker
JavaScript
Easy
Objective
Write a function that calculates if a given year is a leap year
Logic
A year is a leap year IF:
It can be divided exactly by 4
Except: if it can also be divided exactly by 100
Except: it it can aslo be divided exactly by 400
Requirements
The function should be called
isLeapYearIt should take a single parameter,
yearwhich should be a numberIt should return
trueif the year is a leap year, else it should returnfalseYou should NOT use any JavaScript date functions or libraries
Check your solution
Tests
| Function name is isLeapYear | |||
| isLeapYear(2023) | Expected: | false | |
| isLeapYear(2020) | Expected: | true | |
| isLeapYear(2000) | Expected: | true | |
| isLeapYear(1900) | Expected: | false |