Not a language but a framework feature, but jQuery's inArray() method is the most idiotic thing I've ever seen. It returns -1 if the value is not in the array, and the value's index if it is.

Despite the method name suggesting that a boolean is returned, and javascript treating nonzero as true*, if you want to know if a value is in the array, you have to test if the result is not equal to -1, which is one of the least intuitive things I've ever come across.

Also, since its function is exactly the same as Array.IndexOf() and since the index is what it is actually returning, why didn't they just call it IndexOf()?

 

 

*more or less. The fact alone that these kinds of caveats are necessary makes loose typing my top malicious language feature. Tongue Out