The array of JavaScript

Source: Internet
Author: User

1, toLocaleString ()

2. ToString ()

3, ValueOf ()

4, join ()//default use,

Stack:

5. Push ()

6. Pop ()

Queue:

<--------

7. Push ()

8, Shift ()//Get the first item

Add an item to the front of the array and delete it at the back end

--------->

9, Unshift ()

10. Pop ()

Sort

11. Reserve ()

12. Sort ()//Call the ToString () method

Ascending

function Compare (value1,value2) {

if (value1<value2) {

return-1;

}else if (value1>value2) {

return 1;

}else{

return 0;

}

}

numeric type, ascending

function Compare (value1,value2) {

return value2-value1;

}

var values={0,1,5,10,15};

Value.sort (Compare);

13, Concat ()

14, Slice (num1,num2)//from NUM1, to num2 before an end, a total of num2-num1

15, Splice (NUM1,NUM2)//delete: Num1 number of items, num2 number

16, Splice (num1,0, "Object1", "object2")//insert: NUM1 is the starting position, 0 is the number of items deleted, followed by the inserted item

17, Splice (num1,num2, "Object")//Replace: NUM1 is the starting position, NUM2 is the number of items deleted, followed by the inserted item

Find

18, IndexOf ()//from the back to find, parameters: 1, to find the entry 2, find the index of the starting position, return the location of the item to find

19, LastIndexOf ()//from the back to look forward

Iterative methods

20, every (): Runs the given function for each item in the array, and returns True if the function returns true for each item

21, Filter (): Each item of an array runs the given function, and returns a list of the items that the function returns True.

22. ForEach (): Runs the given function for each item in the array, with no return value.

23. Map (): Each item in an array runs the given function, and returns a list of the results of each function call

24, some (): Runs the given function for each item in the array, returns TRUE if the function returns true for any of the entries

Narrowing method

4 Parameters: The previous value, the current value, the index of the item, and the array object, any value returned by this function will be automatically passed to the next item as the first argument.

25, reduce (): Iterates over all the items of an algebraic group, and then constructs a value that is ultimately returned, starting with the first item in the array

26, Reduceright (): Starting from the last item.

The array of JavaScript

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.