1The apply() method accepts arguments in an array:
2
3var arr = [6, 89, 3, 45];
4var maximus = Math.max.apply(null, arr); // returns 89
1Function.prototype.construct = function(aArgs) {
2 let oNew = Object.create(this.prototype);
3 this.apply(oNew, aArgs);
4 return oNew;
5};
6
1Function.prototype.construct = function (aArgs) {
2 let fNewConstr = new Function("");
3 fNewConstr.prototype = this.prototype;
4 let oNew = new fNewConstr();
5 this.apply(oNew, aArgs);
6 return oNew;
7};
8