Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 770 Bytes

findLastIndex.md

File metadata and controls

35 lines (23 loc) · 770 Bytes

arrays.findLastIndex

findLastIndex(array, predicate, [thisArg])

FindLastIndex method returns the value of Last element at which a provided function is true, or undefined if no elements in the array satisfy the function.

Arguments

  1. array (Array): input array
  2. predicate (Function): to be run against each element of the array
  3. [thisArg] (*): this argument in the function

Returns

(*): value of element that satisfied function.

Example

const result = arrays.findLastIndex([5, 12, 8, 130, 44], (x) => x < 10);
console.log(result);
> 2