int String.prototype.indexOf(searchString:string|mixed[, position:uint|mixed=0])
Return the position of first occurrence of searchString in this string value, both coerced to string. Optionally the search starts at position, coerced to int. If the string was not found this function returns -1.
String.prototype.indexOf.length = 1
String.prototype.indexOf = function(searchString, position){
CheckObjectCoercible(this);
var S = ToString(this);
var searchStr = ToString(searchString);
var pos = ToInteger(position);
if (position === undefined) pos = 0;
var len = S.length;
var start = Math.min(Math.max(pos, 0), len);
var searchLen = searchstr.length;
// no specific algorithm is given for searching, many exist.
return S.indexOf(searchStr, start);
}