Answers for "apply js"

3

apply() js

The apply() method accepts arguments in an array:

var arr = [6, 89, 3, 45];
var maximus = Math.max.apply(null, arr); // returns 89
Posted by: Guest on October-09-2020
0

apply js

Function.prototype.construct = function(aArgs) {
  let oNew = Object.create(this.prototype);
  this.apply(oNew, aArgs);
  return oNew;
};
Posted by: Guest on December-19-2020
0

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;
};
Posted by: Guest on December-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language