Determines whether or not the year is a leap year.

Syntax

JSV_isLeapYear(expY)

Prototype

n/a

Returns

The isLeapYear function returns true if the expression expY is a leap year; otherwise, false.

Parameters

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() ).

Remarks

n/a

Dependencies

n/a

Example

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