What's the best alternative to indexOf() for checking existence of element in an array?
In most languages, indexOf()
returns -1 if element is not found, which IMO is a bit counter productive. What's the best alternative to this in you programming language? Is there any function that will just return a boolean value indicating if the element was found?