On Wed, Jul 18, 2018 at 5:44 PM, Cyril Auburtin <[email protected]> wrote: > sorry you get 1, and need again to subtract the array length, `arr.length -1 > - 1` to get the final result 3
So you can't just use the passed-in third argument, and need: ```js let a = [7, 4, 6, 7, 12]; console.log(a.length - 1 - a.findIndex((_, i) => isPrime(a[a.length-1-i]))); ``` Strikes me as a reasonable argument for adding `findLastIndex`. ;-) (And perhaps `findLast`, since the same trick with `find` just won't work at all.) Prior art (looking for instance at the libs that inspired the array additions in ES5 and ES2015): * Lodash implements both `findLastIndex` and `findLast`). * Underscore, PrototypeJS, and MooTools don't as far as I can see from the docs. -- T.J. Crowder
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

