rosyatrandom at gmail.com
Mon Oct 2 16:06:31 UTC 2017
Ah yes, woods, I was looking at the trees.
Still, to carry on with the concise style:
const minMax = (arr=) => arr.reduce(
([min=Infinity, max=-Infinity], curr) => [ min < curr ? min : curr, max >
curr ? max : curr ], 
On Mon, 2 Oct 2017 at 16:55 Xavier Stouder <xavier at stouder.io> wrote:
> Same for Michael. Useless to not use a reducer instead of Math.min and
> Math.max if it has worth performance.
> Just to be clear, the fact is that your function approximately costs:
> Math.min: one loop over the array
> Math.max: one loop over the array
> Math.minMax: one loop over the array
> Math.minMax do in one pass what Math.min and Math.max do in two passes.
> That's the key point.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss