Ranges

Jerry Schulteis jdschulteis at yahoo.com
Sun Jun 24 19:02:38 UTC 2018


 At least Array.build isn't "taken" by MooTools.

For the particular example, I prefer something like [...take(4, oddNumbers())], but in some cases Array.build would provide better clarity.

    On Sunday, June 24, 2018, 10:34:58 AM CDT, Cyril Auburtin <cyril.auburtin at gmail.com> wrote:  
 
 What I'd really like is something to avoid `Array.from({length: n}, (_, i) => ..)`It's very common to use it nowadays
on the + side, it's a wider feature than range, the callback is more powerful to build any kind of ranges
but it feels quite hacky and verbose. you can make a typo on 'length', and have to use the second callback argument.

I'd like a lot a `Array.whateverNameAsShortAsPossible(4, i => 2*i+1) // [1, 3, 5, 7]` I think `Array.build` was proposed a long time ago (array.build)

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180624/525fbb20/attachment-0001.html>


More information about the es-discuss mailing list