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