I remember reading somewhere (I think it was in one of Crockford's papers) that using an array literal []
is better than using the new Array();
notation.
But I can't really remember any advantages of one over the other.
Can anyone please explain to me on why the former is preferred over the latter?
[Update]
Here is a reason on why []
is better than new Array();
:
var Array = function () { };
Overriding the Array
object will break code...!
Any more reasons ?