how to use apply js code example
Example 1: apply js
Function.prototype.construct = function(aArgs) {
let oNew = Object.create(this.prototype);
this.apply(oNew, aArgs);
return oNew;
};
Example 2: apply js
Function.prototype.construct = function (aArgs) {
let fNewConstr = new Function("");
fNewConstr.prototype = this.prototype;
let oNew = new fNewConstr();
this.apply(oNew, aArgs);
return oNew;
};