The value of the first element in the array that satisfies the provided testing function. thisArg Optional Object to use as this inside callback. array Optional The array that find was called on. index Optional The index (position) of the current element in the array. Syntax arr.find( callback(element])) Parameters callback Function to execute on each value in the array, taking 3 arguments:Įlement The current element in the array. If you need to find if any element satisfies the provided testing function, use ().Again, it checks each element for equality with the value instead of using a testing function. If you need to find if a value exists in an array, use (). (It’s similar to findIndex(), but checks each element for equality with the value instead of using a testing function.) If you need to find the index of a value, use ().If you need the index of the found element in the array, use findIndex().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.
0 Comments
Leave a Reply. |