I should to write a function isLeapYear.t should accept a number of millisecond or string of date as an argument. This function checks if a passed argument is a Leap Year. If it is a Leap Year, function should return a string – ‘ “year” is a leap year’ and if it isn’t, should return string - ‘ “year” is not a leap year’. I should work with Date object. I know that this work not as i want
if (year % 400 == 0)
leap = true;
else if (year % 100 == 0)
leap = false;
else if (year % 4 == 0)
leap = true;
else
leap = false;
For Example isLeapYear('2020-01-01 00:00:00'); // => ‘2020 is a leap year’
isLeapYear('2020-01-01 00:00:00777'); // => ‘Invalid Date’
isLeapYear('2021-01-15 13:00:00'); // => ‘2021 is not a leap year’
isLeapYear('2200-01-15 13:00:00'); // => ‘2200 is not a leap year’
isLeapYear(1213131313135465656654564646542132132131); // => ‘Invalid Date’
isLeapYear(1213131313); ); // => ‘1970 is not a leap year’