How to Use slice () in js

Source: Internet
Author: User

The Javascript example explains: This example uses the Slice (start, [end]) method of the Array object. This method returns a new Array, contains the elements specified by the source function from start to end, but does not include the end element, such as. slice (); If start is negative, it is processed as length + start. Here, length is the length of the array, such as. slice (-3, 4), equivalent to. slice (2, 4 ). If end is negative, it is processed as length + end. Here, length is the length of the array, for example, a. slice (0,-1 ). If end is omitted, the slice method will always be copied to the end of the source array, for example, a. slice (1 ). If end appears before start, no elements are copied to the new array, such as a. slice ).
<Html> <pead> <title> use the slice Method to return a Javascript example of part of the array </title> </pead> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

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.