Is typing "var foo = []" the same as typing "var foo = new Array()"?
Asked
Active
Viewed 445 times
1
-
See a also http://stackoverflow.com/q/931872/615754 – nnnnnn Mar 08 '16 at 06:01
-
@RayonDabre—the OP (and others) may not get the satire. ;-) So many dupes, so little time… – RobG Mar 08 '16 at 06:01
-
@TedHopp, I take my words back as I am unable to find convincing document o defend my statement..`WebStorm` used to warn me in earlier days for `new Array()` but it must be because of some JSLints... – Rayon Mar 08 '16 at 06:10
-
1@RayonDabre—there is definitive proof that it isn't though, see [*ECMA-262 §22.1.1*](http://www.ecma-international.org/ecma-262/6.0/#sec-array-constructor). ;-) – RobG Mar 08 '16 at 06:15
-
`new Array(n)` is helpful when you want to declare an empty array of n `undefined` element – amd Mar 08 '16 at 07:16