docs: private static Object iterativeMethod(Context cx, IdFunctionObject idFunctionObject, Scriptable scope,
                                            Scriptable thisObj, Object[] args)
      {
          Scriptable o = ScriptRuntime.toObject(cx, scope, thisObj);
  
          // execIdCall(..) uses a trick for all the ConstructorId_xxx calls
          // they are handled like object calls by adjusting the args list
          // as a result we have to handle ConstructorId_xxx calls (negative id)
          // the same way and always us the abs value of the id for method selection
          int id = Math.abs(idFunctionObject.methodId());
          if (Id_find == id || Id_findIndex == id) o = requireObjectCoercible(cx, o, idFunctionObject);
  
          long length = getLengthProperty(cx, o, id == Id_map);
          Object callbackArg = args.length > 0 ? args[0] : Undefined.instance;
          if (callbackArg == null || !(callbackArg instanceof Function)) {
              throw ScriptRuntime.notFunctionError(callbackArg);
          }
          if (cx.getLanguageVersion() >= Context.VERSION_ES6 && (callbackArg instanceof NativeRegExp)) {
              // Previously, it was allowed to pass RegExp instance as a callback (it implements Function)
              // But according to ES2015 21.2.6 Properties of RegExp Instances:
              // > RegExp instances are ordinary objects that inherit properties from the RegExp prototype object.
              // > RegExp instances have internal slots [[RegExpMatcher]], [[OriginalSource]], and [[OriginalFlags]].
              // so, no [[Call]] for RegExp-s
              throw ScriptRuntime.notFunctionError(callbackArg);
          }
  
          Function f = (Function) callbackArg;
          Scriptable parent = ScriptableObject.getTopLevelScope(f);
          Scriptable thisArg;
          if (args.length < 2 || args[1] == null || args[1] == Undefined.instance) {
              thisArg = parent;
          } else {
              thisArg = ScriptRuntime.toObject(cx, scope, args[1]);
          }
  
          Scriptable array = null;
          if (id == Id_filter || id == Id_map) {
              int resultLength = id == Id_map ? (int) length : 0;
              array = cx.newArray(scope, resultLength);
          }
          long j=0;
          for (long i=0; i < length; i++) {
              Object[] innerArgs = new Object[3];
              Object elem = getRawElem(o, i);
              if (elem == Scriptable.NOT_FOUND) {
                  if (id == Id_find || id == Id_findIndex) {
                      elem = Undefined.instance;
                  } else {
                      continue;
                  }
              }
              innerArgs[0] = elem;
              innerArgs[1] = Long.valueOf(i);
              innerArgs[2] = o;
              Object result = f.call(cx, parent, thisArg, innerArgs);
              switch (id) {
                case Id_every:
                  if (!ScriptRuntime.toBoolean(result))
                      return Boolean.FALSE;
                  break;
                case Id_filter:
                  if (ScriptRuntime.toBoolean(result))
                      defineElem(cx, array, j++, innerArgs[0]);
                  break;
                case Id_forEach:
                  break;
                case Id_map:
                  defineElem(cx, array, i, result);
                  break;
                case Id_some:
                  if (ScriptRuntime.toBoolean(result))
                      return Boolean.TRUE;
                  break;
                case Id_find:
                  if (ScriptRuntime.toBoolean(result))
                      return elem;
                  break;
                case Id_findIndex:
                  if (ScriptRuntime.toBoolean(result))
                      return ScriptRuntime.wrapNumber(i);
                  break;
              }
          }
          switch (id) {
            case Id_every:
              return Boolean.TRUE;
            case Id_filter:
            case Id_map:
              return array;
            case Id_some:
              return Boolean.FALSE;
            case Id_findIndex:
              return ScriptRuntime.wrapNumber(-1);
            case Id_forEach:
            default:
              return Undefined.instance;
          }
      }