JS Program Development-1

Source: Internet
Author: User

The push () method adds one or more elements to the end of the array and returns the length of the new array.

The Unshift () method adds one or more elements to the beginning of the array and returns the length of the new array.

The Pop () method deletes the last element of the array and returns the value of the deleted element. If the array is already empty, pop () does not change the array and returns the undefined value. The shift () method is used to remove the first element of the array and return the value of the deleted element. If the array is empty, then the shift () method does nothing and returns the undefined value.

Concat () joins an array to form a new array the method is used to concatenate another or more arrays after an array. It does not change the existing array and returns the new array after the connection. The Concat () method can accept the value, or it can accept the array as an argument. Array1.concat (Array2,array3,...);

Join () connects the elements of the array to a string by specifying the delimiter.

The split () method is used to split a string into an array of strings and must specify the delimiter to use. If the delimiter is an empty string (""), each character in the string is split. You can specify the Howmany parameter, which is a numeric value that specifies the maximum length of the returned array.

Sort () sorts the array, returning the sorted object. An acceptable parameter, which must be a function.

Splice () the element used to insert, delete, or replace an array. First, you must specify index, where the element is inserted/removed. The parameter is a numeric value, which is the subscript of the element. Second, you must specify the number of elements to delete, which can be 0. If this parameter is not specified, all elements from index start to the end of the original array are deleted. If you want to insert an element, you can write the new element as a parameter in parentheses, separating the new elements from each other.

JS Program Development-1

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.