JavaScript Intensive Tutorial--basic processing functions for arrays

Source: Internet
Author: User

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

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.