JavaScript Array findIndex() Method
The findIndex() method in JavaScript is used to return the index of the first element in an array that satisfies the provided testing function. If no such element is found, it returns -1. It does not modify the original array. Syntax Parameters Parameters Descriptions callback A function to test each element of the array. It…