findLast

Modified on Mon, 03 Apr 2023

Use this function to iterate the array in reverse order and return the value of the first element that satisfies the provided testing function.

Syntax

findLast(collection:T | null | undefined, predicate:ObjectIterateeCustom, fromIndex:number):

Returns

Return ValueDescription
Date
Return the value of the first element 

Sample

findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; });   returns 3