lang/js/ ApplyParametersToFunction


From here at mozilla

const numbers = [5, 6, 2, 3, 7];

const max = Math.max.apply(null, numbers);

console.log(max);
// Expected output: 7

const min = Math.min.apply(null, numbers);

console.log(min);
// Expected output: 2

To apply with new we need the following from this stackoverflow question:

let s = new (Function.prototype.bind.call(Something, null, a, b, c))
let s = new (Function.prototype.bind.apply(Something, [null, a, b, c]))