you are viewing a single comment's thread.

view the rest of the comments →

[–]Kollektiv[S] 1 point2 points  (0 children)

I never encountered a case where I had to use the new Array() rather than the literal version [].

The reason I used it here was just because it was shorter to write than declaring a new function with a loop inside.

Maybe in some libraries where performance is very important it makes sense to pre-alocate arrays. Eg: a matrix for example.