docs: private static int  js_indexOf(int methodId, String target, Object[] args) {
          String searchStr = ScriptRuntime.toString(args, 0);
          double position = ScriptRuntime.toInteger(args, 1);
  
          if (position > target.length() && methodId != Id_startsWith && methodId != Id_endsWith) {
              return -1;
          }
  
          if (position < 0) position = 0;
          else if (position > target.length()) position = target.length();
          else if (methodId == Id_endsWith && (position != position  || position > target.length())) position = target.length();
  
          if (Id_endsWith == methodId) {
              if (args.length == 0 || args.length == 1 || (args.length == 2 && args[1] == Undefined.instance)) position = target.length();
              return target.substring(0, (int)position).endsWith(searchStr) ? 0 : -1;
          }
          return methodId == Id_startsWith
                  ? target.startsWith(searchStr, (int)position) ? 0 : -1
                  : target.indexOf(searchStr, (int)position);
      }