This is how inArray is implemented in jQuery:
function inArray(elem, array, i) { var len; if ( array ) { if ( array.indexOf ) { return array.indexOf.call( array, elem, i ); } len = array.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) {
You cannot use jQuery, but why not use their implementation ?:-)
Respectfully!
source share