Summary of methods in JavaScript array 18

Source: Internet
Author: User
Tags javascript array

1.push (A,b,c,d,e) added to the last side of the array, you can add one or more parameters, change the original array to return the number of added arrays


2.pop () Delete the last array, change the original array to return the deleted value


3.unshift (A,b,c,d,e) added to the front of the array, you can add one or more parameters, change the original array to return the number of added arrays


4.shift () Delete the first of the array, change the original array to return the deleted value


5.reverse () Flips the entire array, changing the original array back to the inverted array


6.concat () Copy array, can add parameters, parameters can also be array (multiple), do not change the original array to return the copied array


7.join () converts an array to a string parameter to be separated by a comma, without changing the original array to return a string


8.toSting () converts an array to a string separated by commas, without altering the original array to return a string


9.slice (m,n) array starting from index m (including m) to index n end (not included) copy, n does not pass default to array to return the copied array without changing the original array


10.splice (m,n,c) (array of changes) array starting from index m (including m) Delete N, add C (can also follow multiple after C) change the original array to return the deleted array
Splice (m,n) (delete array) array from index m (including m) Delete N, change the original array to return the deleted array
Splice (M,0,C) (Increase of array) array from index m (including m) Delete 0, add C (can also follow multiple after C) change the original array to return an empty array


11.sort () array sorting can only be sorted by 0-9, but can give a function expression to change the original array to return the changed array


12.every () determines whether each item in the array is greater than or less than a specific value, the parameter is a function expression does not change the original array return value is False and true () Note: When an array of each item is greater than or less than a specific value is true, otherwise false IE8 is not compatible with the following


13.filter () determines whether each item in the array is greater than or less than a particular value, the argument is a function expression does not change the original array return value is a new array of eligible values IE8 the following incompatible


14.forEach () loops through the values and indexes in the array, and the argument is that a function expression does not change the original array without the return value IE8 the following incompatible


15.map () determines whether each item in the array is greater than or less than a particular value, the argument is a function expression does not change the original array return value is a new array of eligible values, but the array is a Boolean type, each item in the array returns true if it matches the conditional side otherwise false IE8 is incompatible with the following


16.some () determines whether each item in the array is greater than or less than a particular value, the argument is a function expression does not change the original array return value is False and true () Note: This method and every () and similar, But the difference is that some returns true if there is an entry in the array, not conforming to return false IE8 the following incompatibility


17.reduce () array to add, multiply, maximum and minimum values, parameter is a function expression does not change the original array returned calculated value IE8 the following incompatible


18.reduceRight () is the same as reduce (), except that the Reduceright method is incompatible with the IE8 of the array under which the index is processed from large to lower

Summary of methods in JavaScript array 18

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.