On 10.07.2011 15:14, Mike Shaver wrote:
On Sun, Jul 10, 2011 at 7:09 AM, Dmitry A. Soshnikov
<dmitry.soshni...@gmail.com> wrote:
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.
Yes, as I said it *would* work if map had been specified not to skip holes:
Oh, *would* -- I missed it. Sure, but if it *had*, I *wouldn't* mention
it at all ;)
But `map` correctly skips holes, as it should -- to support sparse
arrays. The issue is not in `map`, so that's why I mention `fill`.
Dmitry.
js> [undefined,undefined,undefined,undefined].map(function(_,x)x*x)
[0, 1, 4, 9]
Is that not what you want?
Mike
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss