Home > Web Front-end > JS Tutorial > Introduction to array methods in ja

Introduction to array methods in ja

零下一度
Release: 2017-06-26 11:17:33
Original
2065 people have browsed it
push()
push() method adds one or more elements to the end of the array and returns the new array length.

pop()
The pop() method is the opposite of the push() method. It deletes the last element of the array.

unshift()
The unshift() method is very similar to the push() method. It adds one or more elements to the head. , and returns the length of the new array.

shift()
The shift() method is very similar to the pop() method. It deletes the first element of the array and Returns a new array with other elements moved forward.

join()
The join() method converts all elements in the array into strings and joins them together.

reverse()
#reverse() method sorts the elements in the array upside down.

concat()
The concat() method creates a new array.

slice()
The slice() method returns a slice of the specified array.

splice()
The splice() method is a general method for inserting or deleting elements in an array.

toString()
tostring() converts all elements of the array into strings and outputs a comma-separated list of strings, and The string returned by calling the join() method without any parameters is consistent.
toLocaleString()
##toLocaleString() returns a string representing the element in the array.

The above is the detailed content of Introduction to array methods in ja. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template