Home > Web Front-end > JS Tutorial > body text

Array object method reference_basic knowledge

WBOY
Release: 2016-05-16 19:25:46
Original
1050 people have browsed it

concat method: Returns a new array, which is a combination of two or more arrays. array1.concat([item1[, item2[, . . . [, itemN]]]])

join method: Returns a string value that contains all the elements of the array connected together, the elements are separated by the specified delimiter. arrayObj.join(separator)

pop method: Removes the last element in the array and returns that element. arrayObj.pop()

push method: Adds new elements to an array and returns the new length value of the array. arrayObj.push([item1 [item2 [. . . [itemN ]]]])

reverse method: Returns an Array object with the order of elements reversed. arrayObj.reverse( )

shift method: Remove the first element in the array and return that element. arrayObj.shift( )

slice method: Returns a segment of an array. arrayObj.slice(start, [end])

sort method: Returns an Array object whose elements have been sorted. arrayobj.sort(sortfunction)

splice method: Remove one or more elements from an array, insert a new element at the position of the removed element if necessary, and return the removed element. arrayObj.splice(start, deleteCount, [item1[, item2[, . . . [,itemN]]]])

unshift method: Insert the specified element into the beginning of the array and return the array. arrayObj.unshift([item1[, item2 [, . . . [, itemN]]]])

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!