Learn all about the jQuery function jQuery.inArray().
.indexOf() method in that it returns -1 when it doesn’t find a match. If the first element within the array matches
$.inArray() returns 0.
array, you need to check if it’s not equal to (or greater than) -1.
The comparison between values is strict. The following will return
-1 (not found) because a number is being searched in an array of strings: