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 Value | Description |
---|---|
Date | Return the value of the first element |
Sample
findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); returns 3
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article