On 10.07.2011 14:27, Mike Shaver wrote:
On Sun, Jul 10, 2011 at 6:06 AM, Dmitry A. Soshnikov
<[email protected]>  wrote:
The problem:

Array(4).map(function(x) x * x); // [NaN, NaN, NaN, NaN]
I think it actually produces just [ , , , , ], because map skips
holes.  (If you see the NaN behaviour in FF, please file a bug.)


Sorry, did I wrote NaN? A "hole" of course (i.e. "nothing"), which is by [[Get]] is displayed as `undefined` in Firebug, or just as just ,,,, with toString. Anyway, the issue is in its behavior.


If I hadn't made map skip holes, then the fill pattern would be simple enough:

Array(4).map(function (_,x) x * x);


It's in particular case, you try to multiply indices, which in current implementation of `map` anyway gives unfortunately nothing.

Dmitry.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to