
array.findLastIndex() – ES2022: Returns the **last index** where the testing function returns true or `-1`.
๐ Syntax
index = array.findLastIndex(callbackFn[, thisArg]);
๐งช Example
const nums=[3,5,7,10,7];
console.log(nums.findLastIndex(n => n < 8)); // 4
Comments
Post a Comment