findLast and findLastIndex search an array from the end: findLast returns the last element that satisfies a test function, and findLastIndex returns that element's index. They are the mirror image of find and findIndex, which scan from the front and return the first match. Reaching for findLast is how you get the most recent matching item in a list kept in order, without copying or reversing it first. See the MDN reference.
Implement both as standalone functions that scan from the last index toward the first. Do not call the real Array.prototype methods.
findLast(arr, predicate) // the last element where predicate is truthy, or undefined
findLastIndex(arr, predicate) // the index of that element, or -1
// predicate(element, index, array) — same shape as Array.prototype.find
findLast([1, 2, 3, 4], (n) => n % 2 === 0); // 4 — the last even number
findLastIndex([1, 2, 3, 4], (n) => n % 2 === 0); // 3 — its index
findLast([1, 3, 5], (n) => n % 2 === 0); // undefined — nothing matches
findLastIndex([1, 3, 5], (n) => n % 2 === 0); // -1
0 and stop at the first match; that element is the last match in array order.(element, index, array), exactly like the callback for find. The index is the element's real position, even though the scan runs backward.findLast returns undefined; findLastIndex returns -1. Do not mix them up.Array.prototype.findLast or findLastIndex.