@bionoidAug 18.2012 — #All String objects/literals have a indexOf method, if you however passed in a number or boolean etc, then you will have to convert it to String() first:
Actually I now realise that code isn't right, and having looked at the specs, the function allows an optional starting index to be used, so I re-wrote it: <i> </i> Array.prototype.indexOf = Array.prototype.indexOf || function( item, idx ) { var retVal = 0, startIndex = ( typeof idx === 'number' ? Math.abs( Math.floor( idx ) ) : 0 );
for( var i = startIndex, len = this.length; i < len && this[ i ] !== item; i++ ) ;