Take the 2-minute tour ×  I have the following code  var d = new
Date(); Object.prototype.toString(d); //outputs  "[object
Object]" Object.prototype.toString.apply(d); //outputs "[object
Date]"  Why is this difference and what's going on?
d.toString() // outputs "Tue Nov 06 2012 ..."  So from where
does the Date in "[object Date]" comes from. Is it the native
code of the browser that do the trick?  share|improve this
question add comment  3 Answers   converts Object.prototype to
string and ignores its argument. In   d gets passed as this to
the ToString method (as if d.toString() with toString referring
to Object.prototype.toString was called), which is what the
method respects.  See Function#apply and Object#toString
share|improve this answer But d.toString() is giving entirely
different result. right? –  suhair Nov 6 '12 at 6:49 Yes,
because in that case you are calling Date.prototype.toString not
Object.prototype.toString (i.e. Date instances inherit a
different toString method). –  RobG Nov 6 '12 at 6: