问题
I need the index of the first value in the array, that matches a custom compare function.
The very nice underscorej has a "find" function that returns the first value where a function returns true, but I would need this that returns the index instead. Is there a version of indexOf available somewhere, where I can pass a function used to comparing?
Thanks for any suggestions!
来源:https://stackoverflow.com/questions/12356642/is-there-an-indexof-in-javascript-to-search-an-array-with-custom-compare-functio