Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

leap year condition in javascript

//Easiest Leap-year condition
function isLeapyear(year){
    if(year%4==0  ||  year%400==0   &&   year%1000!=0){
        return true;
    }
    else{
        return false;
    }
}


const my_year = isLeapyear(1999);  //Tip: 2000 is a leap year.

console.log('My year is', my_year );
 
PREVIOUS NEXT
Tagged: #leap #year #condition #javascript
ADD COMMENT
Topic
Name
4+6 =