Array.prototype.findIndex(fn, startIndex = 0)

Jordan Harband ljharb at gmail.com
Thu Aug 15 22:03:41 UTC 2019


I believe every array iteration method that takes a callback, except for
reduce and reduceRight, take an optional receiver as the last argument (the
`this` value), so they can't be meaningfully/ergonomically extended.

On Thu, Aug 15, 2019 at 3:00 PM Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> isn't the second argument already reserved for the context?
>
> ```js
> [1, 2, 3].findIndex(function (i) { return i == this; }, 2);
> // 1
> ```
>
> On Thu, Aug 15, 2019 at 11:51 PM Cyril Auburtin <cyril.auburtin at gmail.com>
> wrote:
>
>> It should be possible to add a second optional argument to the `find` and
>> `findIndex` array methods, similarly to `indexOf`
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> _______________________________________________
> 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/20190815/854d8e34/attachment.html>


More information about the es-discuss mailing list