The findIndex()
method of Array
instances returns the index of the first element in an array that satisfies the provided testing function. If no elements satisfy the testing function, -1 is returned.
See also the find()
method, which returns the first element that satisfies the testing function (rather than its index).