I'm going through John Resig's JavaScript ninja tutorial and on #51 I see this:
// Find the largest number in that array of arguments
var largestAllButFirst = Math.max.apply( Math, allButFirst );
allButFirst
is just a small array of integers. I believe I understand what apply
does, but I can't understand why Math
is being passed as an argument to apply
.