code: function applyToNew(constructor, argsArray) {
          // The `new` keyword can only be applied to functions that take a limited number of arguments.
          // - We can fake that with .bind().
          // - It calls a function (`constructor`, here) with the arguments that were provided to it - effectively transforming an unlimited number of arguments into limited.
          // - So `new (constructor.bind(thisArg, arg1, arg2...))`
          // - `thisArg` can be anything (e.g. null) because `new` keyword resets context to the constructor object.
          // We need to pass in a variable number of arguments to the bind() call.
          // - We can use .apply().
          // - So `new (constructor.bind.apply(constructor, [thisArg, arg1, arg2...]))`
          // - `thisArg` can still be anything because `new` overwrites it.
          // Finally, to make sure that constructor.bind overwriting is not a problem, we switch to `Function.prototype.bind`.
          // - So, the final version is `new (Function.prototype.bind.apply(constructor, [thisArg, arg1, arg2...]))`
  
          // The function expects `argsArray[0]` to be `thisArg`.
          // - This means that whatever is sent as the first element will be ignored.
          // - The constructor will only see arguments starting from argsArray[1].
          // - So, a new dummy element is inserted at the start of the array.
          argsArray.unshift(null);
  
          return new (Function.prototype.bind.apply(constructor, argsArray));
      }
docs: Local helper function. Use an array of arguments to call a constructor (function called with `new`). Adapted from https://stackoverflow.com/a/8843181/2263595 It is not necessary to use this function if the arguments can be passed separately (i.e. if the number of arguments is limited). - If that is the case, use `new constructor(arg1, arg2)`, for example. It is not necessary to use this function if the function that needs an array of arguments is not supposed to be used as a constructor. - If that is the case, use `f.apply(thisArg, [arg1, arg2...])`, for example.