Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
10-13-2005, 09:26 AM #1
- Join Date
- Apr 2003
- Bucharest, ROMANIA
- Thanked 379 Times in 375 Posts
just some thoughts about new Date() object
maybe it is a stupid question, but if
var today = new Date() is an object, why it does not accept arguments property?
I know that Date() is a predefined object, yet it looks rather weird that
var today = Date() returns directly a string, while
var today = new Date() is an object needs toString()/valueOf() methods to return a string/numberKOR
10-13-2005, 01:24 PM #2
- Join Date
- Jul 2002
- Chamonix, France
- Thanked 3 Times in 3 Posts
Hey mate - I had a think about this and here's my musings:
the Date constructor is a function, and functions accept arguments. The reference to this function property (arguments) would be:Code:
I would imagine that the arguments are stored in the hash table for the function (in this case the Date function). But as they are not needed to be permanently stored, the garbage collector will pick up this property and clean it out in the same way as declaring a local variable in a function gets memory allocated and garbage collected after each instance usage.
I'll bet all the herring in sweden that jkd knows a shorter answer than this tho
Last edited by martin_narg; 10-13-2005 at 01:29 PM."Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."