code: private Node tryFoldStringCharAt(Node n, Node stringNode, Node arg1) {
      checkArgument(n.isCall());
      checkArgument(stringNode.isString());
  
      int index;
      String stringAsString = stringNode.getString();
  
      if (arg1 != null && arg1.isNumber()
          && arg1.getNext() == null) {
        index = (int) arg1.getDouble();
      } else {
        return n;
      }
  
      if (index < 0 || stringAsString.length() <= index) {
        // http://es5.github.com/#x15.5.4.4 says "" is returned when index is
        // out of bounds but we bail.
        return n;
      }
  
      Node resultNode = IR.string(
          stringAsString.substring(index, index + 1));
      Node parent = n.getParent();
      parent.replaceChild(n, resultNode);
      reportChangeToEnclosingScope(parent);
      return resultNode;
    }
docs: Try to fold .charAt() calls on strings