Answers for "js leap year calculator"

0

js leap year calculator

// https://www.mathsisfun.com/leap-years.html 
function isLeapYear(year) {
 
    if(year % 400 === 0){
        return ("yes");
    } if(year % 100 === 0){
        return ("no");
    } if (year % 4 === 0){
        return ("yes");
    } else {
        return ("no");
    }
    

}


isLeap(2024);
Posted by: Guest on May-12-2021
0

js leap year calculator

// https://www.mathsisfun.com/leap-years.html 
function isLeapYear(year) { 

    if(year % 400 === 0){
        return (year + " is a leap year.");
    } if(year % 100 === 0){
        if(year % 400 === 0){
            return (year + " is a leap year.");
        } else {
          return (year + " is not a leap year.");
        }
    } if (year % 4 === 0){
        if(year % 100 === 0){
           return (year + " is not a leap year.");
        } else {
        return (year + " is a leap year.");
        }
    } else {
        return (year + " is not a leap year.");
    }

}

// leap year
// isLeap(2024);

// not leap year 
// isLeap(1930);
Posted by: Guest on May-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language