code: 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;
    }
docs: Try to evaluate String.indexOf/lastIndexOf:
  "abcdef".indexOf("bc") -> 1
  "abcdefbc".indexOf("bc", 3) -> 6