JavaScript Array findLast() Method Last Updated : 17 Nov, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The JavaScript findLast() method is used to retrieve the last element in an array that meets a specified condition.Example 1: This example shows how findLast() can be used to find the last even number in an array. JavaScript const a = [1, 3, 5, 7, 6, 8]; const b = a.findLast(num => num % 2 === 0); console.log(b); Output : 8Example 2: This example shows how findLast() can be used to find the last string in an array that has more than 3 characters. JavaScript const a = ['cat', 'dog', 'elephant', 'lion']; const b = a.findLast(word => word.length > 3); console.log(b); Output:'elephant'Syntax : array.findLast(callback(element[, index[, array]])[, thisArg]);callback: A function to test each element, receiving the current element, index, and array.thisArg (optional): A value to use as this when executing callback.JavaScript Array findLast() Method - FAQsWhat is findLast in JavaScript?The findLast() method returns the last element in an array that satisfies a provided testing function.How to get the last of an array in JavaScript?Use array.findLast(callback) to retrieve the last element matching a specific condition.What arguments does findLast take in JavaScript?The findLast() method takes a callback function that checks each element and an optional thisArg to set the this value in the callback.How to use findLastIndex in JavaScript?findLastIndex() returns the index of the last element that satisfies a given testing function, or -1 if none is found.How to check if the last element of an array matches a condition?Use array.findLast(callback) to see if the last matching element in the array meets a specific condition. Comment More infoAdvertise with us Next Article Javascript Program for Last duplicate element in a sorted array A anujpaz9pe Follow Improve Article Tags : JavaScript Web Technologies javascript-array Similar Reads JavaScript Array findLastIndex() Method The Javascript findLastIndex() method is used to find the index of the last element in an array that matches the specified condition. It works by iterating over the array from the end to the beginning and returning the index of the first element that satisfies the condition specified in a callback f 2 min read JavaScript Array lastIndexOf() Method The JavaScript Array lastIndexOf() Method is used to find the index of the last occurrence of the search element provided as the argument to the function.Syntax: array.lastIndexOf(element, start)Parameters: This method accepts two parameters as mentioned above and described below: element: This para 3 min read JavaScript TypedArray.prototype.findLast() Method A new method, TypedArray.prototype.findLast(), was introduced in ECMAScript 2023 (ES2023). The method findLast() of instances TypedArray proceeds traverse over the typed array backwards and provides method returning the value of the first element that satisfies the supplied testing function. When th 2 min read TypeScript Array lastIndexOf() Method The Array.prototype.lastIndexOf() method in TypeScript is used to find the last index at which a given element can be found in the array, searching backwards from the fromIndex. It returns the index of the found element, or -1 if the element is not present.Syntax:array.lastIndexOf(searchElement[, fr 2 min read Javascript Program for Last duplicate element in a sorted array We have a sorted array with duplicate elements and we have to find the index of last duplicate element and print index of it and also print the duplicate element. If no such element found print a message. Examples: Input : arr[] = {1, 5, 5, 6, 6, 7}Output :Last index: 4Last duplicate item: 6Input : 3 min read JavaScript Program to Find kth Largest/Smallest Element in an Array JavaScript allows us to find kth largest/smallest element in an array. We are given an array containing some elements, we have to find kth smallest/largest element from the array where k is a number greater than zero and less than equal to the total number of elements present in the array. There are 5 min read Like