Skip to content

Instantly share code, notes, and snippets.

@zoubin
Created June 29, 2016 10:27
Show Gist options
  • Save zoubin/9d5cd3fd387fae4b6d69c717d9a03934 to your computer and use it in GitHub Desktop.
Save zoubin/9d5cd3fd387fae4b6d69c717d9a03934 to your computer and use it in GitHub Desktop.
Check if the given year is a leap year
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