JavaScript - Arrays - findIndex


// JavaScript - Array.prototype.findIndex()
The findIndex() method returns an index of the first element in the array that 
satisfies the provided testing function. Otherwise -1 is returned.

arr.findIndex(callback[, thisArg])

callback: Function to execute on each value in the array, taking three arguments: 
1. element: The current element being processed in the array.
2. index: The index of the current element being processed in the array.
3. array: The array findIndex was called upon.

thisArg: Optional. Object to use as this when executing callback.

The findIndex method returns an index in the array if an element passes the 
test; otherwise, -1.

The findIndex method does not mutate the array on which it is called.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License