findLast()
is an Array method. It is used to find an element from the last to the first of an array with a condition function. findLast()
method is planned for ES14.
Example: Find the first element from end of the array that is divisible by 3.
const arr = [3, 5, 6, 9, 10];
const result = arr.findLast((ele) => ele % 3 === 0);
console.log(result); // 9