javascript - I have a couple of questions related to the use of call() and apply(), or how these two types, Array() and Math are called in this example -


  Make a array of multi-max (multi) {// all, but the first argument is var allButFirst = Array ( ) .slice.call (logic, 1); // Find the largest number of arguments in that largest number allButFirst = Math.max.apply (mathematics, allButFirst); // Multi Result Returns Multiple Return * Largest AllButFirst; } Insert (Multi-Max (3, 1, 2, 3) == 9, "3 * 3 = 9 (First, the biggest argument.)");   

to

I have two questions for someone.

  1. Why we need to use Array (). Math () Maximum.
  2. Why we use arrays (). Piece, and not Array.prototype.slice (I have seen that Array.prototype.slice will work, but I am trying to understand why I am the other, only in this example, but in any instance)

    Thank you.

    Michael Elkan