How to use JavaScript Arrays

Source: Internet
Author: User
The Array of JavaScript is also an interesting topic. Although it is named Array, the method on the Array object is more like the result of mixing many things together. In traditional programming languages such as C/Java, elements in the array need to have the same data type, but as weak JavaScript, there is no such restriction, the Array of JavaScript is also an interesting topic. Although it is named Array, the method on the Array object is more like the result of mixing many things together. In traditional programming languages such as C/Java, elements in the array need to have the same data type, but as weak JavaScript, there is no such restriction. In fact, javaScript can have different types of elements in the same array.
Method Description
Concat () Concatenate two or more arrays and return results.
Join () Put all elements of the array into a string. The elements are separated by the specified delimiter.
Pop () Delete and return the last element of the array.
Push () Add one or more elements to the end of the array and return a new length.
Reverse () The order of elements in the array is reversed.
Shift () Delete and return the first element of the array.
Slice () Returns the selected element from an existing array.
Sort () Sorts the elements of an array.
Splice () Delete elements and add new elements to the array.
Unshift () Add one or more elements to the beginning of the array and return a new length.
ValueOf () Returns the original value of the array object.
It can be seen that the array objects of JavaScript are complex, including pop, push, and other operations similar to stack, as well as slice, reverse, and sort operations similar to list operations. Perhaps because of this, the Array Function in JavaScript is very powerful.
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.