Array.prototype.reduce ( callbackfn [ , initialValue [ , thisArg ] ] )

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Sat Mar 21 09:01:43 PDT 2009

Adding to David-Sarah's comments, here is how I would expect a call that needs to supply a thisArg to be expressed:


It almost makes me wonder if we should drop the thisArg from the standard for the other "array extra" functions and leave it as an implementation extension:
Pros: It's unnecessary, leaving it out of the standard may wean thisArg usage.
Cons: Because of the legacy, all implementation are going to implement the thisArg any, so it is better to have a standard specification for it.

Of course, all the other "array extras" are specified with a thisArg so consistency argues that reduce and reduceRight should be specified that way too.

More information about the Es-discuss mailing list