laangry.blogg.se

Findindex array javascript
Findindex array javascript











The findIndex() method executes the callback function once for every index in the array until it finds the one where callback returns a truthy value. The index of the first element in the array that passes the test. thisArg Optional Optional object to use as this when executing callback. array Optional The array findIndex() was called upon. index Optional The index of the current element being processed in the array. It takes three arguments: element The current element being processed in the array. Syntax arr.findIndex( callback( element] ))Ī function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.

findindex array javascript

See also the find() method, which returns the value of an array element, instead of its index. If you'd like to contribute to the interactive examples project, please clone and send us a pull request. The source for this interactive example is stored in a GitHub repository.













Findindex array javascript