That
eval('new Date()')
evaluates to a Date object?
I'm a little confused here - to reply "No" there you need to be Eric
Bednarz.
No. That's what the specification of eval says should happen. I
don't
test things for doing what they are supposed to do without a reason
to suspect that thay don't. Do you have any reason to suppose it
won't give a Date object?
I did. As I recall, and as I said in my previous reply, if I put in
"Math" I got results appropriate to the Math object, showing for
example that its .cos existed; but when I put in, or thought I put in,
"new Date()" I did not get an indication that its .getTime existed.
Are you trying to distinguish between the Date function (aka. Date
constructor), and a Date object? The latter is an object created
by using the Date constructor with the "new" operator. The former
is a function, the latter is not.
I see no reason to distinguish between the Math object and a Date
object, except for the detail that there is only one Math object
(hence the "the"), but using the Date constructor you can create
multiple Date objects.
The distinction is that, when JavaScript starts, a Date object exists,
with a property referenced by Date.UTC; AFAIK, that Date contains no
value, there is bo Date.valueOf. But, when JavaScript starts, there
are no objects such as are created ny new Date().
Earlier, my page shwed distinct difference in behavious between the
two cases, and therefore I needed a suitable nomenclature. Now that
both are broken, that's less important, at least if neither or both
get mended.
I see that the small Flanagan book ... fumble fumble ... and the big
one class .getDate under "Methods" and .UTC under "Static Methods",
which is not entirely satisfactory - I'd need to use "non-Static
Methods".
In my earlier testing independently of the page of interest, I must
have been doing something wrong.
To show why one should not believe that browsers always behave as the
standards imply, consider
new Date(Y, 0, 1) - new Date(Y + "/01/01")
One might expect a result of zero, always. But not in my Safari 5.1
(Win XP sp3), where y=2050 gives 864e5 (IIRC, about a third of years
do that). Then, for some of us, there's always the possibility of
having misunderstood the standard.
For further possible response, I'll wait till my proper newsreader
gets the articles.