--- id: 5a23c84252665b21eecc7ede title: Leap year challengeType: 5 --- ## Description
Determine whether a given year is a leap year in the Gregorian calendar.
## Instructions
## Tests
``` yml tests: - text: isLeapYear should be a function. testString: assert(typeof isLeapYear == 'function', 'isLeapYear should be a function.'); - text: isLeapYear() should return a boolean. testString: assert(typeof isLeapYear(2018) == 'boolean', 'isLeapYear() should return a boolean.'); - text: isLeapYear(2018) should return false. testString: assert.equal(isLeapYear(2018), false, 'isLeapYear(2018) should return false.'); - text: isLeapYear(2016) should return true. testString: assert.equal(isLeapYear(2016), true, 'isLeapYear(2016) should return true.'); - text: isLeapYear(2000) should return true. testString: assert.equal(isLeapYear(2000), true, 'isLeapYear(2000) should return true.'); - text: isLeapYear(1900) should return false. testString: assert.equal(isLeapYear(1900), false, 'isLeapYear(1900) should return false.'); - text: isLeapYear(1996) should return true. testString: assert.equal(isLeapYear(1996), true, 'isLeapYear(1996) should return true.'); - text: isLeapYear(1800) should return false. testString: assert.equal(isLeapYear(1800), false, 'isLeapYear(1800) should return false.'); ```
## Challenge Seed
```js function isLeapYear(year) { // Good luck! } ```
## Solution
```js function isLeapYear (year) { return (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0); }; ```