JavaScript learning note--4. Arrays

Source: Internet
Author: User

1. The role of arrays

Bulk processing of data

2. Declaring an array

var arr=[element 1, Element 2, Element 3 ...]//Express Declaration

ARR[1]//Invoke element

var arr=new array (element 1, Element 2, element 3);//declaration using Array Object mode

3. Iterating through an array

For loop

4. Array processing functions

. length//array Length (properties)

. Sort ()//Sort (can have callback function)

. push ()//Add elements (into the stack) after the array

. Pop ()//The element after the divisor group (out of stack \ stack is LIFO)

. Unshift ()//Add elements in front of the array (into the queue)

. Shift ()//Remove the elements in front of the divisor group (out of queue \ queue for FIFO)

. Join ()//concatenate the array into a string using the passed-in connector

. Splice ()//Remove an element

. toString ()//The string representation of the returned object (available for all object types)

@zhnoah
Source: http://www.cnblogs.com/zhnoah/
This article is owned by me and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original
The right to pursue legal liability.

JavaScript learning note--4. Arrays

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.