Created
June 29, 2016 10:27
-
-
Save zoubin/9d5cd3fd387fae4b6d69c717d9a03934 to your computer and use it in GitHub Desktop.
Check if the given year is a leap year
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLeap(year) { | |
var d = new Date(year + '') | |
d.setMonth(1) | |
d.setDate(29) | |
return d.getDate() === 29 | |
} | |
module.exports = isLeap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment