Javascript:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
with (new Date(y, m, d))
return (getMonth()==m && getDate()==d); /* was y, m */
}
Javascript:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
with (new Date(y, m, d))
return (getMonth()==m && getDate()==d); /* was y, m */
}
Simple:
function ValidDate(y, m, d) {
var date = new Date(y, m, d);
return date.getMonth() == m && date.getDate() == d;
}
with
makes it so that the this
scope is the statement in the with
so you don't have to do any .functionName(...)
What you can do:
function ValidDate(y, m, d)
{ // m = 0..11 ; y m d integers, y!=0
var date = new Date(y, m, d);
return (date.getMonth()==m && date.getDate()==d); /* was y, m */
}