Re: [jslint] +new Date() - a question of readabilty
- On 6 Mar 2010, at 13:15:15, walfisch_in_the_sea wrote:
> +new Date() === new Date().getTime();new Date() returns an object.
> +new Date() returns a timestamp. Is this good style? Or should it be avoided?
+new Date() forces conversion of the object to be a number as if you had used new Date().valueOf().
You could also do that in other ways:
None of this tricky coding is as clear as using new Date().getTime(), so imo the tricky coding is not good style and should be avoided. Program text should be written in a way that is clearest for people to read and understand and not so as to save typing a few extra characters.