Wanted: standard Array function to append an array's elements to another array

Jeff Walden jwalden+es at MIT.EDU
Thu Jul 28 14:44:23 PDT 2011

On 07/27/2011 10:12 PM, Mark S. Miller wrote:
> We could debate the pros and cons of this sort of chaining convention in general. However, in this case I think the more important issue is API consistency.

I was thinking this might actually be more consistent, to return this.  Consider Array.prototype.sort, for example.  (Or maybe the new length would be more consistent with Array.prototype.push, on second thought.)

It does seem a reasonable guideline to return something when something can be returned, and not to return nothing.  Returning |undefined| was just my not having thought of an obviously meaningful and plausible value to return.  But I'm fine with any of these return values -- the pushing-the-array-contents business is the only truly important part of the method to me.


More information about the es-discuss mailing list