371"Use the array literal notation ."
- Jan 30, 2009Part of my project uses a statement like the following:
var b = new Array(a.length);
but jslint complains:
Use the array literal notation .
My theory here is that it is better to start the array with the length
already initialized, rather than create an empty one and push the
implemented, this might be faster.
I'm not exactly sure why using the Array constructor would be bad,
except possibly because someone else might have redefined it. So in
that case should I be writing this?
var b = .constructor(a.length);
Or is my assumption about performance incorrect?
- Next post in topic >>