Array.prototype.sort( callbackfn [ , thisArg ] )

Jordan Harband ljharb at gmail.com
Tue Nov 12 06:42:09 UTC 2019


I'd assume it's because sort predates ES5, when the thisArg was added; and
also because a well-behaved comparator only operates based on `a` and `b` -
why would you need a receiver?

On Mon, Nov 11, 2019 at 7:34 PM Michaël Rouges <michael.rouges at gmail.com>
wrote:

> Hi all,
>
> Is there a reason to not have a `thisArg ` for the
> `Array.prototype.sort()` callback?
>
> Actually, it enforces to bind the context or to have nested functions,
> each one creating a new function where it isn't strictly necessary.
>
> Michaël Rouges - https://github.com/Lcfvs - @Lcfvs
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20191111/9020c07e/attachment.html>


More information about the es-discuss mailing list