Knowledgize

.findLastIndex(callbackFn)

Returns the index of the last element in the array that satisfies the provided testing function. If no elements satisfy the testing function, -1 is returned.

Examples:

const numbers = [2, 3, 5, 8, 13, 21]; const lastIndexOver10 = numbers.findLastIndex(num => num > 10); console.log(lastIndexOver10); // 5 const words = ['react', 'angular', 'vue', 'svelte']; const lastIndexLongWord = words.findLastIndex(word => word.length > 4); console.log(lastIndexLongWord); // 3