Determines whether or not the year is a leap year.
JSV_isLeapYear(expY)
n/a
The isLeapYear function returns true if the expression expY is a leap year; otherwise, false.
The isLeapYear function uses the following argument.
Argument | Description |
expY | expD | A year (e.g., 1998 and 2003) or a date object ( e.g., var todayIs = new Date() ). |
n/a
n/a
The following lines of code
var year = 1900;
document.write("Is the year " + year + " a leap year? " + JSV_isLeapYear(year));
year = 2000;
document.write("Is the year " + year + " a leap year? " + JSV_isLeapYear(year));
year = 2002;
document.write("Is the year " + year + " a leap year? " + JSV_isLeapYear(year));
var todayIs = new Date();
document.write("Is the date " + todayIs + " a leap year? " + JSV_isLeapYear(todayIs) + JSV_br() );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.