Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting "Invalid Date" from Date.prototype? [duplicate]

Tags:

javascript

Possible Duplicate:
Why does Chrome Dev Tool show a dates __proto__ as Invalid Date?

I get a weird message when I look up the prototype of the Date object:

Date.prototype; // Invalid Date

This is strange; why am I not getting the object from the prototype of Date as expected? Furthermore, the message that it returns is a string, but typeof(Date.prototype) returns "object". I also find that peculiar. Why am I getting this output?

like image 285
David G Avatar asked Oct 21 '22 18:10

David G


1 Answers

15.9.5 Properties of the Date Prototype Object

The Date prototype object is itself a Date object (its [[Class]] is "Date") whose [[PrimitiveValue]] is NaN.

NaN is what's happening

like image 105
Joe Avatar answered Nov 15 '22 06:11

Joe