cheaper version of indexOf; instead of creating each iteration new str.
490003
function indexOf(word, p, c) {
    var j = 0;
    while ((p + j) <= word.length) {
      if (word.charAt(p + j) == c) return j;
      j++;
    }
    return -1;
  }
799909
function indexOf(items, item) {
    var len = items.length, i;
    for (i = 0; i < len; i++) {
      if (items[i] === item) {
        return i;
      }
    }
    return -1;
  }
1212490
function at(index) {

    if (!this) {
        throw TypeError();
    }

    const str = '' + this,
        len = str.length;

    if (index >= len) {
        return;
    }
    if (index < 0) {
        index = len - index;
    }

    let i = 0;
    for (let item of str) {
        if (i === index) {
            return item;
        }
    }

    return;

}
454972
private int cordToIndex(int... cords)
    {
        if(cords.length != realIndexToCatIndex.length)
            throw new RuntimeException("Something bad");
        int index = 0;
        for(int i = 0; i < cords.length; i++)
        {
            index = cords[i] + dimSize[i]*index;
        }
        return index;
    }
443600
function (str, index) {
            var res = false;
            for (var i = index - 1; i >= 0; i--) {
                if (str.charAt(i) == "\\") {
                    res = !res;
                } else {
                    return res;
                }
            }
            return res;
        }
977049
function indexesOf(a, elt) {
  var ret = [], index = 0;
  while ((index = a.indexOf(elt, index)) !== -1) {
    ret.push(index++);
  }
  return ret;
}
1202453
public static char idx( String str, int index ) {
        int i = calculateIndex( str.length(), index );

        char c = str.charAt( i );
        return c;
    }
329447
function fromIndex(a, index) {
    var arr = is.isArguments(a) ? arraySlice.call(a) : a;
    return arraySlice.call(arr, index, arr.length);
}
343663
public static int indexOf(double[] array, double val) {
        for (int i=0; i<array.length; i++) {
            if (array[i] == val) {
                return i;
            }
        }
        return -1;
    }
1118659
function(arr, iterator) {
  var i = arr.length - 1, index = null

  if(i >= 0){
    do {
      if(iterator(arr[i])) {
        index = i
        break
      }
    } while(i--)
  }

  return index
}
1130980
public static int indexOf(CharSequence seq, CharSequence pattern, int fromIndex)
    {
        return indexOf(seq, pattern, (int a, int b)->{return a==b;}, fromIndex);
    }
1177668
private Node tryFoldStringIndexOf(
      Node n, String functionName, Node lstringNode, Node firstArg) {
    checkArgument(n.isCall());
    checkArgument(lstringNode.isString());

    String lstring = NodeUtil.getStringValue(lstringNode);
    boolean isIndexOf = functionName.equals("indexOf");
    Node secondArg = firstArg.getNext();
    String searchValue = NodeUtil.getStringValue(firstArg);
    // searchValue must be a valid string.
    if (searchValue == null) {
      return n;
    }
    int fromIndex = isIndexOf ? 0 : lstring.length();
    if (secondArg != null) {
      // Third-argument and non-numeric second arg are problematic. Discard.
      if (secondArg.getNext() != null || !secondArg.isNumber()) {
        return n;
      } else {
        fromIndex = (int) secondArg.getDouble();
      }
    }
    int indexVal = isIndexOf ? lstring.indexOf(searchValue, fromIndex)
                             : lstring.lastIndexOf(searchValue, fromIndex);
    Node newNode = IR.number(indexVal);
    n.replaceWith(newNode);
    reportChangeToEnclosingScope(newNode);

    return newNode;
  }
410324
@Override
    public int indexOf(Object arg0) {
        int indexOf = allResults.indexOf(arg0);
        if ( indexOf >= 0 )
            return indexOf;

        while ( nextResultsAvailable() ) {
            indexOf = nextResults.indexOf(arg0);
            int size = allResults.size();
            moveNextResults();
            if ( indexOf >= 0 )
                return indexOf + size;
        }

        return -1;
    }
754871
function createFind(findIndexFunc) {
      return function(collection, predicate, fromIndex) {
        var iterable = Object(collection);
        if (!isArrayLike(collection)) {
          var iteratee = getIteratee(predicate, 3);
          collection = keys(collection);
          predicate = function(key) { return iteratee(iterable[key], key, iterable); };
        }
        var index = findIndexFunc(collection, predicate, fromIndex);
        return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1;
      };
    }
238900
function (str, n) {
      n = window.parseInt(n, 10);
      return new Array(n + 1).join(str);
    }
364192
function repeatString(str, len) {
  return Array.apply(null, {length: len + 1}).join(str).slice(0, len)
}
544238
private int indexOf( String content, String needle, int offset ) {
        int index;
        while( (index = content.indexOf(needle, offset)) != -1 ) {
            String text = getLine(content, index).trim();
            if (text.startsWith(needle) || text.endsWith(needle))
                break;
            else
                offset = index + 1;
        }
        return index;
    }