Answers for "how to check leap year in javascript"

5

find leap year javascript

function isLeap(year) {
   if (year % 4 === 0) {
      if (year % 100 === 0){
         if (year % 400 == 0){
            return ("Leap year.");
         } else {
            return ("Not leap year.");
         }
      } else {
         return ("Leap year.");
      }
   } else{
      return ("Not leap year.");
   }
}
Posted by: Guest on July-01-2020
2

how to check leap year in javascript

function isLeapYear(year) {
  if (year % 400 === 0) return true;
  if (year % 100 === 0) return false;
  return year % 4 === 0;
}
Posted by: Guest on January-21-2021
1

javascript leap year

function isLeapYear(year){
	if(year % 400 === 0 && year % 4 === 0){
      return true
    } else {
      return false
    }
}
Posted by: Guest on April-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language