Array object method reference _ basic knowledge

Source: Internet
Author: User
For the Array object method, refer to the concat method: return a new Array, which is composed of two or more arrays. Array1.concat ([item1 [, item2 [,... [, itemN])

Join method: returns the string value, which contains all elements of the connected array. The elements are separated by the specified separator. ArrayObj. join (separator)

Pop method: remove the last element from the array and return the element. ArrayObj. pop ()

Push method: add new elements to an array and return the new Length Value of the array. ArrayObj. push ([item1 [item2 [... [itemN])

Reverse Method: returns an Array object whose element order is reversed. ArrayObj. reverse ()

Shift: removes the first element from the array and returns the element. ArrayObj. shift ()

Slice Method: return a segment of an array. ArrayObj. slice (start, [end])

Sort method: returns an Array object whose elements have been sorted. Arrayobj. sort (sortfunction)

Splice method: removes one or more elements from an array. If necessary, insert a new element at the position of the removed element to return the removed element. ArrayObj. splice (start, deleteCount, [item1 [, item2 [,... [, itemN])

Unshift: insert the specified element into the starting position of the array and return the array. ArrayObj. unshift ([item1 [, item2 [,... [, itemN])
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.