Advertisement
asgfgh

Leap Year Calculator JS

Jul 7th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*If the year is divisible by 4 and not divisible by 100 unless the number is divisible by 400, the year is a leap year.*/
  2.  
  3. function isLeapYear(year){
  4. if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
  5.   console.log(year + ' is a leap year.')
  6. } else {
  7.   console.log(year + ' is not a leap year.')
  8.   }
  9. }
  10.  
  11. isLeapYear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement