On the use of the JavaScript function and the call method, there are many articles on the Internet, I do not have many words. Apply and call function very similar, but the way of use is different
The first parameter of apply and call is an object, which is used to swap the function itself for this point, which is the alias.
Starting with the 2nd argument is the argument passed to the function. The difference between apply and call is in this parameter form, one is to put all the parameters into an array, one is written in turn.
First, the following:apply accepts the array form of the parameter set, call is to write the parameters in sequence .
The egg hurts is I often can't remember whether to apply an array form or call with an array form, use when a confused need to check the data to determine.
Today, suddenly found to be very good to remember, so share to have the same distress of people:
Apply, the first letter is A, and the array is the word array , the first letter is also a, so apply accepts the parameters in the form of an array.
It's easy to correspond. Anyway, I will not be confused later.
This article from: http://jo2.org/%E7%9E%AC%E9%97%B4%E8%AE%B0%E4%BD%8Fjavascript%E4%B8%ADapply%E4%B8%8Ecall%E7%9A%84%E5%8C%BA%E5%88%AB/
Instantly remember the difference between apply and call in JavaScript