Why does Array.from also take a mapFn?

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jun 25 12:23:17 PDT 2013


On Jun 25, 2013, at 12:12 PM, Rick Waldron wrote:

> 
> 
> 
> On Tue, Jun 25, 2013 at 3:09 PM, Hudson, Rick <rick.hudson at intel.com> wrote:
> I'm trying to understand this particular line.
> 
> var squaredSmalls_try3 = Int16Array.from(smalls, map(v=> v*v));  //the plan is for this to work.
> 
> To me I would expect a complaint that map is undefined. Should map be implied?
> 
> It looks like a leftover from copying this line:
> 
> > Int16Array.from(smalls.map(v=> v*v));  
> 
> assume that he means:
> 
> Int16Array.from(smalls, v=> v*v);  

yup, that's what I meant.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130625/078e559a/attachment.html>


More information about the es-discuss mailing list