Second arguments for Array.prototype.sort: map function
Peter Michaux
petermichaux at gmail.com
Thu Feb 23 18:12:49 PST 2012
On Mon, Feb 20, 2012 at 11:52 AM, Xavier MONTILLET
<xavierm02.net at gmail.com> wrote:
> what I would like is to be able to do this:
>
> var sortedArray = array.sort( compare, f );
I think the above is not very readable.
The following is more readable and shows the order in which the more
modular parts are being applied.
var sortedArray = array.map(f).sort(compare);
Peter
More information about the es-discuss
mailing list