Check if year is leap year in javascript

 function leapYear(year){
    var result; 
    year = parseInt(document.getElementById("isYear").value);
    if (years/400){
      result = true
    }
    else if(years/100){
      result = false
    }
    else if(years/4){
      result= true
    }
    else{
      result= false
    }
    return result
 }

This is what I have so far (the entry is on a from thus stored in "isYear"), I basically followed this here, so using what I already have, how can I check if the entry is a leap year based on these conditions(note I may have done it wrong when implementing the pseudocode, please correct me if I have) Edit: Note this needs to use an integer not a date function

Answers


function leapYear(year)
{
  return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
}

Need Your Help

Sharing ASP.NET_SessionId and .ASPXAUTH cookie security risk

asp.net security cookies sitecore session-cookies

We're developing a SAAS solution for a big company in which doctors can view patients and make mutations, order products, provide licenses.

How do you create nested dict in Python?

python python-2.7 dictionary mapping nested

I have 2 csv files. First one is data file and other one is mapping file. Mapping file has 4 columns Device_Name GDN Device_Type Device_OS