Why doesn't Array.from() pass the array to the mapFn?
T.J. Crowder
tj.crowder at farsightsoftware.com
Wed May 3 11:46:20 UTC 2017
On Wed, May 3, 2017 at 12:39 PM, the kojoman <kojoman at gmail.com> wrote:
> Thanks for the clarification. I thought the mapping was applied
> afterwards.
>
> I would still argue that it would be better to skip it all together than
> having it and not working like the existing map function.
>
So Array.from(array-like).map(mapFn) is the way to go then?
>
Why make two passes over the contents rather than just one?
It is interesting that `Array.from` doesn't pass its first parameter
(`items`, the source object) as the third argument to the mapping function.
I suspect it's because the index doesn't necessarily work with the source
object, if an iterator is being used...
-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170503/1565af38/attachment.html>
More information about the es-discuss
mailing list