The Reflect.construct() method is used to invoke a function as a constructor. It's similar to the new operator. The function that will be invoked is called as the target constructor.
One special reason why you may want to use the Reflect.construct() method instead of the new operator is that you can target the constructor's prototype to match the prototype of another constructor.
The Reflect.construct() method takes three arguments:
- The first argument is the target constructor.
- The second argument is an array, specifying the arguments of the target constructor. This argument is optional.
- The third argument is another constructor whose prototype will be used as the prototype of the ...