Just seen a factory style object creating in JavaScript (without literals). What else do I need to k
- by alex
I have just seen this in code
var thisYear = (new Date()).getFullYear();
See it live on JSbin.
This is cool, as I've always done something like that in 2 lines, i.e. create the new object instance and assigned it to a variable, then called the method on it.
Is this new method fine to use everywhere? Any gotchas?