- functional.js description and source code analysis
Found that most people are used Array.prototype.slice.call (argments, 0), had not understand what the sentence is. The last revision of the slice () method, then reference Function.call (thisArg [, arg1 [, arg2 [, ...]]]) , or do not know (I brain turn slowly: |). Internet search, check first foreigner to Google.com in English did not explain, really to find the "Array.prototype.slice use" only when they get a few articles . While I despise people who engage in collecting, and made the Internet a great copy paper like the world like, but now hate less, only three (exactly the same three, editor for the admin or super-administrator, the author is Anonymous. )
Here my understanding, Array.prototype.slice.call to explain, rookie left, prawn spit:
Array.prototype.slice.call (thisArg [, arg1 [, arg2 [, ...]]])
Array objects (that is, an array of objects)
Segmentation of the array, a method useful, concrete look here or there .
Magic method, which is all the Function object in the way, so there is a method of slice. Function object used to replace inside this target. See here .
String up is:
Use human language to say that the Array has a prototype, slice is the prototype of his son, call a slice of his wife (a lot of bricks came.) Please continue to look down.
Array.prototype.slice.call == .slice
Although the result is a kind of running, but after testing (others to do the test, not me), the efficiency of the former than the latter greatly improved, so it is so applied.
Here is a Function object slice method. Typically, the programmer through the following method call Function, in essence, an ordinary function call method:
As for the call () method, METHOD: Function:: call us, you can
Function.call(thisArg[, arg1[, arg2[, ...]]])
In the form of calling a Function object, this object among Replace thisArg, which can be the following code:
Using pseudo-code simulation process:
Well, we use pseudo-code to simulate the entire process:
Similarly, Array.prototype.slice.apply (obj) and similar code can also be understood that, as long as the prototype not interfere on the line. See here do not understand them, please review the Array.slice (begin, End) .
 Array.prototype.slice.apply Tips
Related Posts of Array.prototype.slice.call self
1) Rails defines two abstract class: AbstractRequest and AbstractResponse code is not posted, first take a look at Response. 2) is mainly responsible for the specific ctgi_process.rb main interface is responsible for implementation methods of impleme ...
Flash's role: The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed to the very next action and then cleared out. This is a great way of doing notices and alerts. In fact it is a mecha ...
Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of timers and to update the page Ajax.request encountere ...
1, for a total test architecture 1) thin-client, business logic rules in the server-side implementation of the majority. Such as news sites, portals, information websites. 2) fat client, a high security requirements, frequent interaction, complex bus ...
Today was how to resolve the following complex json object to the difficult living over a long time .. did not find documentation how to read JsonReader Ways json object (possibly also because of their limited level of E the text did not correctly underst
In the project in order to achieve a listener in web.xml set up a listener, did start in Tomcat actually occurred after java.lang.NoClassDefFoundError: javax / servlet / ServletContextListener this anomaly google and found the reasons for the lack of serv
Super Medium ejb hate. . . . . . . . . . . . . . . . . . . ================================================ To configure a Message Driven Bean in a different application server parameters are not the same. Currently only passed the test jboss. Message Dri