This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive Tutorial--basic processing function of 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 of elements that have been given to the custom, returns the index of the first element found, or returns 1 map () if not found The A= method passes each element of the called array to the specified function and returns an array that contains the return value of the function [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: http://www.h5edu.cn/htm/step/h5edu_44.html
JavaScript Intensive Tutorial--basic processing functions for arrays