JavaScript Intensive Tutorial--basic processing functions for arrays

Source: Internet
Author: User

This article ish5eduAgency officialHTML5 Trainingtutorials, the main introduction:JavaScript Intensive Tutorials--the basic processing function of the array
 

Array.push (); add element at the end of the array and return the array to the new length Array.pop (); Delete the last element, decrease the length of the array, and return the last element Array.unshift (); Add an element before the array array.splice (n,x ); n array subscript x deletes several deletions starting with N (X=1, indicating that the element that is currently subscript n is deleted) indexOf () searches the entire array for the element that has been given to the customization, returns the index of the first element found, or returns the number of the 1 map () method that will be called if it is not found Each element of the group is passed to the specified function and returns an array containing the return value of the function a= [1,2,3];b=a.map (function () {return x*x;}); b is the [1,4,9] character array of the basic handler function 1.substr (x,n) output a string, from the x backwards output n tips similar to splice (X,N); SUBSTR (n) nth character 3.charCodeAt (n) output from Nth to last 2.charAt (n) output string nth character encoding example checking the number of occurrences of a character x characters 4.join (n) implements a character array into a string Insert N5.split between two elements ("cut by a character in a string"); Implements a string to be converted into a character array. 6.sort () sorts the array of characters in alphabetical order, returns the array 7.reverse () reverses the sort 8.replace ("Hello", "Hello"), and the string is replaced by 9. String.prototype.left = function () {string method extension}

Click to enter JavaScript intensive tutorial

This article is from the "11721999" blog, please be sure to keep this source http://11731999.blog.51cto.com/11721999/1846321

JavaScript Intensive Tutorial--basic processing functions for arrays

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.