Array. Prototype. silce. Call Comprehension

Source: Internet
Author: User

In many frameworks, I encountered this method, but I didn't study it for a while. As long as I was asked some time ago, I was helpless. Therefore, we need to keep an accurate understanding of our study.

Array. Prototype. Slice. Call (thisarg [, arg1 [, arg2 [,...])
Member introduction:

ArrayArray object

Prototype[Property]
Is the property of an object in Javascript. It is used to return the prototype reference of the object. You can dynamically add methods and attributes to this object, such as array, object, or user-defined object. For details, seeHere

Slice[Function]
Use the original array object to intercept the specified part and return a newArrayObject. For details, seeHere

Call[Function]Call ([Thisobj[,Arg1[, Arg2[,[,. Argn])

Call a method of one object to replace the current object with another object. For details, seeHere.

 

After the above is understood one by one, we can understand it.

Array. Prototype. Slice. Call (thisobj, start, end)The thisobj object is partitioned into a new array through the call method.

As follows:

<! Doctype HTML> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content =" text/html; charset = UTF-8 "/> <br/> <title> call </title> <br/> <SCRIPT type =" text/JavaScript "> <br/> function FN () {<br/> A = array. prototype. slice. call (arguments, 2); <br/> alert (a); <br/>}< br/> FN (1, 2, 3, 5 ); <br/> </SCRIPT> <br/> </pead> <br/> <body> <br/> </ptml>

RunCode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.