JavaScript array.findLast() Function

JavaScript Logo

array.findLast() – ES2022: Returns the **last element** that satisfies the testing function.

๐Ÿ‘‰ Syntax

element = array.findLast(callbackFn[, thisArg]);

๐Ÿงช Example

const nums=[3,5,7,10,7];
console.log(nums.findLast(n => n < 8)); // 7

Comments