Array extras feedback

Lasse R.H. Nielsen atwork at
Fri Jul 31 04:16:26 PDT 2009

On Fri, 31 Jul 2009 01:55:53 +0200, Jeff Walden <jwalden+es at> wrote:

> Brendan asked me yesterday to look at and comment on the array extras  
> methods as they exist in ES5, since things are being finalized yesterday  
> and today.  (I'm not sure whether yesterday was the latest to make these  
> comments or whether today is also acceptable; unfortunately Black Hat  
> proceedings destroyed my day yesterday.  So it goes.)  Overall they look  
> fine; I find myself somewhat amused that the descriptions in the spec  
> are apparently copied from MDC with slight modifications, improvements,  
> and clarifications.  :-)

Rereading them, I also notice this wording in the "reduce" function:

"callbackfn should be a function that takes four arguments. reduce calls  
the callback, as a
function, once for each element present in the array, in ascending order."

If the optional initalValue is omitted, reduce actually does one less call  
(omitting the call
for the first element).

The "ascending order" doesn't specify that it's the order of the element's  
not their value.

There is a similar problem in the reduceRight function.


More information about the es-discuss mailing list