372Re: "Use the array literal notation ."
- Jan 30, 2009--- In firstname.lastname@example.org, James Clark <sbj@...> wrote:
>If you can demonstrate a significant performance advantage, then I
> Part 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?
will relax the test. Stylistically, I think  is better, but I will
bow to a compelling performance argument.
- << Previous post in topic Next post in topic >>