Behavior of Array(n).join(s)
waldron.rick at gmail.com
Mon Jul 16 13:49:37 PDT 2012
On Mon, Jul 16, 2012 at 4:39 PM, Patrick Mulder <mulder.patrick at gmail.com>wrote:
> I am rather new to ES and this group, but I am surprised by this behavior:
> When I do:
> >>> [undefined, undefined, undefined, undefined]
> And when I do:
> >>> Array(4).join(" * ")
> " * * * "
> In other languages, I would not be able to join undefined objects.
> Also, if it would be, I am surprised that I get only 3 x * whereas
> above, I have 4 undefined. Anyone has some pointers, what I am
Take a look at 18.104.22.168 Array.prototype.join:
Specifically, #8 explains how undefined and null are treated and #10 A-E
explain how the separator and items in the array are concatenated
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss