for-of statement of sparse array

Brandon Benvie brandon at brandonbenvie.com
Fri Jul 6 00:59:53 PDT 2012


Hey look, it's my favorite example.

var powersOf2 = Array.apply(null, new
Array(32)).map(Function.prototype.call.bind(Number)).map(Math.pow.bind(null,
2))

> var powersOf2 = []
> >
> > for (var index=0; index<16; index++) {
> >   powersOf2.push(Math.pow(2, index))
> > }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120706/df85e57c/attachment.html>


More information about the es-discuss mailing list