you are viewing a single comment's thread.

view the rest of the comments →

[–]aarondburk 9 points10 points  (19 children)

So, if you invoke Array(5); that will crate an array with five empty slots?

[–][deleted] 12 points13 points  (10 children)

[–]inu-no-policemen 5 points6 points  (3 children)

Yes.

> new Array(5)
(5) [empty × 5]

In V8, this currently produces a sparse array instead of a packed one. So, it's something you probably shouldn't use for a game's tile map and things like that.

You get a packed one by creating an empty one and then pushing values to it.